mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-28 20:53:54 +02:00
avformat/electronicarts: More chunk_size checks
Fixes: Timeout
Fixes: 26909/clusterfuzz-testcase-minimized-ffmpeg_dem_EA_fuzzer-6489496553783296
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 d03f0ec9a1
)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
20b13122ec
commit
4db70e2139
@ -607,10 +607,14 @@ static int ea_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
break;
|
||||
} else if (ea->audio_codec == AV_CODEC_ID_PCM_S16LE_PLANAR ||
|
||||
ea->audio_codec == AV_CODEC_ID_MP3) {
|
||||
if (chunk_size < 12)
|
||||
return AVERROR_INVALIDDATA;
|
||||
num_samples = avio_rl32(pb);
|
||||
avio_skip(pb, 8);
|
||||
chunk_size -= 12;
|
||||
} else if (ea->audio_codec == AV_CODEC_ID_ADPCM_PSX) {
|
||||
if (chunk_size < 8)
|
||||
return AVERROR_INVALIDDATA;
|
||||
avio_skip(pb, 8);
|
||||
chunk_size -= 8;
|
||||
}
|
||||
@ -694,6 +698,8 @@ static int ea_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
case fVGT_TAG:
|
||||
case MADm_TAG:
|
||||
case MADe_TAG:
|
||||
if (chunk_size > INT_MAX - 8)
|
||||
return AVERROR_INVALIDDATA;
|
||||
avio_seek(pb, -8, SEEK_CUR); // include chunk preamble
|
||||
chunk_size += 8;
|
||||
goto get_video_packet;
|
||||
|
Loading…
Reference in New Issue
Block a user