]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/pnmdec: Use unsigned for maxval rescaling
authorMichael Niedermayer <michael@niedermayer.cc>
Fri, 15 May 2020 22:31:23 +0000 (00:31 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Thu, 21 May 2020 07:31:08 +0000 (09:31 +0200)
Fixes: signed integer overflow: 65535 * 55335 cannot be represented in type 'int'
Fixes: 21955/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PGMYUV_fuzzer-5669206981083136
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/pnmdec.c

index dbcaef38848b3f97b35fd87715dd1c5223b2a5c8..e03e52297f7c02099f7b4054f9e1e5690a68abce 100644 (file)
@@ -132,7 +132,7 @@ static int pnm_decode_frame(AVCodecContext *avctx, void *data,
                 init_put_bits(&pb, ptr, linesize);
                 for(j=0; j<avctx->width * components; j++){
                     unsigned int c=0;
-                    int v=0;
+                    unsigned v=0;
                     if(s->type < 4)
                     while(s->bytestream < s->bytestream_end && (*s->bytestream < '0' || *s->bytestream > '9' ))
                         s->bytestream++;