Browse Source

avformat/rmdec: Initialize and sanity check offset in ivr_read_header()

Fixes: signed integer overflow: -9223372036854775808 - 17 cannot be represented in type 'long'
Fixes: 18768/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5674385247830016

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 7e665e4a81)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
tags/n4.0.6
Michael Niedermayer 6 years ago
parent
commit
2715341726
1 changed files with 3 additions and 1 deletions
  1. +3
    -1
      libavformat/rmdec.c

+ 3
- 1
libavformat/rmdec.c View File

@@ -1174,7 +1174,7 @@ static int ivr_read_header(AVFormatContext *s)
uint8_t key[256], val[256];
AVIOContext *pb = s->pb;
AVStream *st;
int64_t pos, offset, temp;
int64_t pos, offset=0, temp;

pos = avio_tell(pb);
tag = avio_rl32(pb);
@@ -1191,6 +1191,8 @@ static int ivr_read_header(AVFormatContext *s)
offset = temp;
temp = avio_rb64(pb);
}
if (offset <= 0)
return AVERROR_INVALIDDATA;
avio_skip(pb, offset - avio_tell(pb));
if (avio_r8(pb) != 1)
return AVERROR_INVALIDDATA;


Loading…
Cancel
Save