Commit a37c6202 authored by Michael Niedermayer's avatar 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@yandex.ru)
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 8b710ea5
...@@ -5876,6 +5876,11 @@ static int mov_read_sample_encryption_info(MOVContext *c, AVIOContext *pb, MOVSt ...@@ -5876,6 +5876,11 @@ static int mov_read_sample_encryption_info(MOVContext *c, AVIOContext *pb, MOVSt
unsigned int subsample_count; unsigned int subsample_count;
AVSubsampleEncryptionInfo *subsamples; 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); *sample = av_encryption_info_clone(sc->cenc.default_encrypted_sample);
if (!*sample) if (!*sample)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment