Found using oss-fuzz
in file g10/parse-packet.c, function parse_symkeyenc, there is an undefined shift with -1 as exponent in macro S2K_DECODE_COUNT
Patch could be so simple as using iobuf_get_noeof instead of iobuf_getas done elsewhere in this function
diff --git a/g10/parse-packet.c b/g10/parse-packet.c index 7f4c7b5c6..0d28e7ac1 100644 --- a/g10/parse-packet.c +++ b/g10/parse-packet.c @@ -1191,7 +1191,7 @@ parse_symkeyenc (IOBUF inp, int pkttype, unsigned long pktlen, } if (s2kmode == 3) { - k->s2k.count = iobuf_get (inp); + k->s2k.count = iobuf_get_noeof (inp); pktlen--; } k->seskeylen = seskeylen;
Bug can be reproduced running
gpg --list-packets clusterfuzz-testcase-minimized-fuzz_list-4890449025171456.dms