avformat/moflex: Check pop_int() for overflow

Fixes: signed integer overflow: 2 * 2132811776 cannot be represented in type 'int'
Fixes: 25722/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-6221704077246464

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2020-09-20 21:23:38 +02:00
parent 7170d342e5
commit dfbea7b210
1 changed files with 2 additions and 0 deletions

View File

@ -62,6 +62,8 @@ static int pop_int(BitReader *br, AVIOContext *pb, int n)
if (ret < 0) if (ret < 0)
return ret; return ret;
if (ret > INT_MAX - value - value)
return AVERROR_INVALIDDATA;
value = 2 * value + ret; value = 2 * value + ret;
} }