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

Michael Niedermayer git at videolan.org
Thu Jul 26 03:43:25 EEST 2018


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Sat Jul 21 17:20:44 2018 +0200| [a37c62026991853a17ce9e19ff0cf39b2a2b1974] | committer: Michael Niedermayer

avformat/mov: Check default_encrypted_sample before use in mov_read_sample_encryption_info()

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>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a37c62026991853a17ce9e19ff0cf39b2a2b1974
---

 libavformat/mov.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 870c603f0b..82cd410a72 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -5876,6 +5876,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);



More information about the ffmpeg-cvslog mailing list