diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2024-03-23 00:08:17 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2024-03-26 23:19:49 +0100 |
commit | 0a114d7318ab0e2499531bf496392d1bee4130fc (patch) | |
tree | fce2b3e8ffd7117b75192c502b09ddd97f6fa0a2 /libavformat/mov.c | |
parent | 9df11820650b1d93f6a49519aaa51afb5cc17086 (diff) | |
download | ffmpeg-0a114d7318ab0e2499531bf496392d1bee4130fc.tar.gz |
avformat/mov: Do not deallocate heif_item in a input dependant way
Fixes: out of array access
Fixes: 67070/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-5685384082161664
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/mov.c')
-rw-r--r-- | libavformat/mov.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c index a4d95a4b23..8483b34a9a 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -8079,7 +8079,7 @@ static int mov_read_iloc(MOVContext *c, AVIOContext *pb, MOVAtom atom) } item_count = (version < 2) ? avio_rb16(pb) : avio_rb32(pb); - heif_item = av_realloc_array(c->heif_item, item_count, sizeof(*c->heif_item)); + heif_item = av_realloc_array(c->heif_item, FFMAX(item_count, c->nb_heif_item), sizeof(*c->heif_item)); if (!heif_item) return AVERROR(ENOMEM); c->heif_item = heif_item; @@ -8201,7 +8201,7 @@ static int mov_read_iinf(MOVContext *c, AVIOContext *pb, MOVAtom atom) avio_rb24(pb); // flags. entry_count = version ? avio_rb32(pb) : avio_rb16(pb); - heif_item = av_realloc_array(c->heif_item, entry_count, sizeof(*c->heif_item)); + heif_item = av_realloc_array(c->heif_item, FFMAX(entry_count, c->nb_heif_item), sizeof(*c->heif_item)); if (!heif_item) return AVERROR(ENOMEM); c->heif_item = heif_item; |