diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2021-12-07 09:14:08 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2022-04-13 23:39:50 +0200 |
commit | e1793ad68e8e71d3850b44be6ac72df06c3d7ae5 (patch) | |
tree | c742232d29922302e1cc5765f87a0c41eeacbf47 | |
parent | 60500dfc38012613d1dfde59c4ad45e90e0136cf (diff) | |
download | ffmpeg-e1793ad68e8e71d3850b44be6ac72df06c3d7ae5.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>
(cherry picked from commit 0dcd95ef8a2e16ed930296567ab1044e33602a34)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavformat/4xm.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libavformat/4xm.c b/libavformat/4xm.c index 8e2d305b24..bce2727d79 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; } |