aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-01-12 22:18:59 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2021-09-09 13:53:29 +0200
commit4db70e21390abadc6087ebad7b1ff80a06209af8 (patch)
treea6e57463aadefb9ce783af00cbe44e32e3ba528f /libavformat
parent20b13122ec42398936f9e97c88b827792d583bc0 (diff)
downloadffmpeg-4db70e21390abadc6087ebad7b1ff80a06209af8.tar.gz
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 d03f0ec9a1ce9903ae533059d30758bede238e40) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/electronicarts.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavformat/electronicarts.c b/libavformat/electronicarts.c
index eddc81b8ee..4c1b64cca9 100644
--- a/libavformat/electronicarts.c
+++ b/libavformat/electronicarts.c
@@ -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;