[FFmpeg-devel] [PATCH] avformat/mov: Check default_encrypted_sample before use in mov_read_sample_encryption_info()

Michael Niedermayer michael at niedermayer.cc
Sat Jul 21 19:14:38 EEST 2018


Fixes: 2018-0721-sample
Fixes: null pointer dereference

Found-by: Nikita Knyzhov (knnikita at yandex.ru)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavformat/mov.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index eda3fff6d5..edd7778023 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -5846,6 +5846,11 @@ static int mov_read_sample_encryption_info(MOVContext *c, AVIOContext *pb, MOVSt
     unsigned int subsample_count;
     AVSubsampleEncryptionInfo *subsamples;
 
+    if (!sc->cenc.default_encrypted_sample) {
+        av_log(c->fc, AV_LOG_ERROR, "Missing schm or tenc\n");
+        return AVERROR_INVALIDDATA;
+    }
+
     *sample = av_encryption_info_clone(sc->cenc.default_encrypted_sample);
     if (!*sample)
         return AVERROR(ENOMEM);
-- 
2.18.0



More information about the ffmpeg-devel mailing list