aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/4xm.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-12-07 09:14:08 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2021-12-16 22:31:13 +0100
commit0dcd95ef8a2e16ed930296567ab1044e33602a34 (patch)
treeed57486744c32c2c7d392e67e4682ae9b590e0f8 /libavformat/4xm.c
parente22ec484aab7a75d5cefb654885c18c3a7b8e948 (diff)
downloadffmpeg-0dcd95ef8a2e16ed930296567ab1044e33602a34.tar.gz
avformat/4xm: Consider max_streams on reallocating tracks array
Fixes: OOM Fixes: 41595/clusterfuzz-testcase-minimized-ffmpeg_dem_FOURXM_fuzzer-6355979363549184 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/4xm.c')
-rw-r--r--libavformat/4xm.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavformat/4xm.c b/libavformat/4xm.c
index f918b1fc57..848991af5b 100644
--- a/libavformat/4xm.c
+++ b/libavformat/4xm.c
@@ -137,7 +137,8 @@ static int parse_strk(AVFormatContext *s,
return AVERROR_INVALIDDATA;
track = AV_RL32(buf + 8);
- if ((unsigned)track >= UINT_MAX / sizeof(AudioTrack) - 1) {
+ if ((unsigned)track >= UINT_MAX / sizeof(AudioTrack) - 1 ||
+ track >= s->max_streams) {
av_log(s, AV_LOG_ERROR, "current_track too large\n");
return AVERROR_INVALIDDATA;
}