diff mbox

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

Message ID 20180721161438.19514-1-michael@niedermayer.cc
State Accepted
Commit a37c62026991853a17ce9e19ff0cf39b2a2b1974
Headers show

Commit Message

Michael Niedermayer July 21, 2018, 4:14 p.m. UTC
Fixes: 2018-0721-sample
Fixes: null pointer dereference

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

Comments

Michael Niedermayer July 26, 2018, 12:41 a.m. UTC | #1
On Sat, Jul 21, 2018 at 06:14:38PM +0200, Michael Niedermayer wrote:
> Fixes: 2018-0721-sample
> Fixes: null pointer dereference
> 
> Found-by: Nikita Knyzhov (knnikita@yandex.ru)
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/mov.c | 5 +++++
>  1 file changed, 5 insertions(+)

will apply

[...]
diff mbox

Patch

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);