mirror of https://git.ffmpeg.org/ffmpeg.git
avformat/bfi: Check offsets better
Fixes: signed integer overflow: -2145378272 - 538976288 cannot be represented in type 'int'
Fixes: 45690/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-5015496544616448
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 35dc93ab44
)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
485aeea57c
commit
a162f52438
|
@ -140,12 +140,12 @@ static int bfi_read_packet(AVFormatContext * s, AVPacket * pkt)
|
||||||
audio_offset = avio_rl32(pb);
|
audio_offset = avio_rl32(pb);
|
||||||
avio_rl32(pb);
|
avio_rl32(pb);
|
||||||
video_offset = avio_rl32(pb);
|
video_offset = avio_rl32(pb);
|
||||||
audio_size = video_offset - audio_offset;
|
if (audio_offset < 0 || video_offset < audio_offset || chunk_size < video_offset) {
|
||||||
bfi->video_size = chunk_size - video_offset;
|
|
||||||
if (audio_size < 0 || bfi->video_size < 0) {
|
|
||||||
av_log(s, AV_LOG_ERROR, "Invalid audio/video offsets or chunk size\n");
|
av_log(s, AV_LOG_ERROR, "Invalid audio/video offsets or chunk size\n");
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
|
audio_size = video_offset - audio_offset;
|
||||||
|
bfi->video_size = chunk_size - video_offset;
|
||||||
|
|
||||||
//Tossing an audio packet at the audio decoder.
|
//Tossing an audio packet at the audio decoder.
|
||||||
ret = av_get_packet(pb, pkt, audio_size);
|
ret = av_get_packet(pb, pkt, audio_size);
|
||||||
|
|
Loading…
Reference in New Issue