GSS_BUFSIZE is too small
mutt-1.11.1/imap/auth_gss.c: 47 #define GSS_BUFSIZE 8192
Similar to https://gitlab.com/muttmua/trac-tickets/blob/master/tickets/open/3804-HUGE_STRING_is_too_short.txt which I reported a while back.
Since then I've switched from SASL to mutt's native IMAP GSS authentication and it now seems my auth token is just over 8k. Bumping up GSS_BUFSIZE to 16K resolves the problem.
Also since then, mutt SASL auth sets the bufsize using:
mutt-1.11.0/imap/auth_sasl.c: 108 bufsize = ((olen * 2) > LONG_STRING) ? (olen * 2) : LONG_STRING;
I tested with SASL and can authenticate so 2 * olen seems to be suffcient in this case (LONG_STRING == 1024 would not be)
BTW, feels like mutt_to_base64 should return an error if there was data left in the input it couldn't fit into the output.