diff mbox series

[FFmpeg-devel,2/3] avformat/mov: Check for duplicate mdcv

Message ID 20210608192941.15327-2-michael@niedermayer.cc
State Accepted
Commit f54d85cee64b98bca5d2bee703f2a266ea75dce7
Headers show
Series [FFmpeg-devel,1/3] avformat/flvdec: Check data before casting | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Michael Niedermayer June 8, 2021, 7:29 p.m. UTC
Fixes: memleak
Fixes: 34932/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-5456227658235904

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/mov.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 6c99a67ff5..47a8e41236 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -5396,7 +5396,7 @@  static int mov_read_mdcv(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
     sc = c->fc->streams[c->fc->nb_streams - 1]->priv_data;
 
-    if (atom.size < 24) {
+    if (atom.size < 24 || sc->mastering) {
         av_log(c->fc, AV_LOG_ERROR, "Invalid Mastering Display Color Volume box\n");
         return AVERROR_INVALIDDATA;
     }