1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00

avformat/rmdec: Reorder operations to avoid overflow

Fixes: signed integer overflow: -2147483648 - 14 cannot be represented in type 'int'
Fixes: 27659/clusterfuzz-testcase-minimized-ffmpeg_dem_RM_fuzzer-5697250168406016

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2020-12-03 00:54:46 +01:00
parent 401495def6
commit b12e713b80

View File

@ -719,9 +719,9 @@ static int rm_sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stre
av_log(s, AV_LOG_WARNING,
"Index size %d (%d pkts) is wrong, should be %"PRId64".\n",
len, n_pkts, expected_len);
len -= 14; // we already read part of the index header
if(len<0)
if(len < 14)
continue;
len -= 14; // we already read part of the index header
goto skip;
} else if (state == MKBETAG('D','A','T','A')) {
av_log(s, AV_LOG_WARNING,