aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-05-16 00:31:23 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2020-07-01 12:49:26 +0200
commite79c52ad014fa94327a50cf4d90bd9aa7221d8c9 (patch)
tree2787130a2e9da93627cb662048ea76c243d378c0
parent340ac128a2b941eb55c228d64bffbafcd0e00c74 (diff)
downloadffmpeg-e79c52ad014fa94327a50cf4d90bd9aa7221d8c9.tar.gz
avcodec/pnmdec: Use unsigned for maxval rescaling
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> (cherry picked from commit 49459aca47d4803b2188fbf12b758bd2b01e91d7) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/pnmdec.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/pnmdec.c b/libavcodec/pnmdec.c
index 958c5e43b0..2c98e26934 100644
--- a/libavcodec/pnmdec.c
+++ b/libavcodec/pnmdec.c
@@ -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++;