mirror of https://git.ffmpeg.org/ffmpeg.git
avformat/rmdec: Make expected_len 64bit
Fixes: signed integer overflow: 1347551268 * 14 cannot be represented in type 'int'
Fixes: 26458/clusterfuzz-testcase-minimized-ffmpeg_dem_RM_fuzzer-5655364324032512
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 728330462c
)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
607a34f726
commit
6e0988527f
|
@ -700,17 +700,19 @@ static int rm_sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stre
|
||||||
state= (state<<8) + avio_r8(pb);
|
state= (state<<8) + avio_r8(pb);
|
||||||
|
|
||||||
if(state == MKBETAG('I', 'N', 'D', 'X')){
|
if(state == MKBETAG('I', 'N', 'D', 'X')){
|
||||||
int n_pkts, expected_len;
|
int n_pkts;
|
||||||
|
int64_t expected_len;
|
||||||
len = avio_rb32(pb);
|
len = avio_rb32(pb);
|
||||||
avio_skip(pb, 2);
|
avio_skip(pb, 2);
|
||||||
n_pkts = avio_rb32(pb);
|
n_pkts = avio_rb32(pb);
|
||||||
expected_len = 20 + n_pkts * 14;
|
expected_len = 20 + n_pkts * 14LL;
|
||||||
if (len == 20)
|
|
||||||
|
if (len == 20 && expected_len <= INT_MAX)
|
||||||
/* some files don't add index entries to chunk size... */
|
/* some files don't add index entries to chunk size... */
|
||||||
len = expected_len;
|
len = expected_len;
|
||||||
else if (len != expected_len)
|
else if (len != expected_len)
|
||||||
av_log(s, AV_LOG_WARNING,
|
av_log(s, AV_LOG_WARNING,
|
||||||
"Index size %d (%d pkts) is wrong, should be %d.\n",
|
"Index size %d (%d pkts) is wrong, should be %"PRId64".\n",
|
||||||
len, n_pkts, expected_len);
|
len, n_pkts, expected_len);
|
||||||
len -= 14; // we already read part of the index header
|
len -= 14; // we already read part of the index header
|
||||||
if(len<0)
|
if(len<0)
|
||||||
|
|
Loading…
Reference in New Issue