Commit eb350ab7 authored by Jacob Trimble's avatar Jacob Trimble Committed by Michael Niedermayer

avformat/mov: Allow saio/saiz in clear content.

If there is a saio/saiz in clear content, we shouldn't create the
encryption index if we don't already have one.  Otherwise it will
confuse the cenc_filter.

The changed method is also used for senc atoms, but they should not
appear in clear content.

Found by Chromium's ClusterFuzz: https://crbug.com/873432Signed-off-by: 's avatarJacob Trimble <modmaker@google.com>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 130de914
...@@ -5845,6 +5845,9 @@ static int get_current_encryption_info(MOVContext *c, MOVEncryptionIndex **encry ...@@ -5845,6 +5845,9 @@ static int get_current_encryption_info(MOVContext *c, MOVEncryptionIndex **encry
*sc = st->priv_data; *sc = st->priv_data;
if (!frag_stream_info->encryption_index) { if (!frag_stream_info->encryption_index) {
// If this stream isn't encrypted, don't create the index.
if (!(*sc)->cenc.default_encrypted_sample)
return 0;
frag_stream_info->encryption_index = av_mallocz(sizeof(*frag_stream_info->encryption_index)); frag_stream_info->encryption_index = av_mallocz(sizeof(*frag_stream_info->encryption_index));
if (!frag_stream_info->encryption_index) if (!frag_stream_info->encryption_index)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
...@@ -5860,6 +5863,9 @@ static int get_current_encryption_info(MOVContext *c, MOVEncryptionIndex **encry ...@@ -5860,6 +5863,9 @@ static int get_current_encryption_info(MOVContext *c, MOVEncryptionIndex **encry
*sc = st->priv_data; *sc = st->priv_data;
if (!(*sc)->cenc.encryption_index) { if (!(*sc)->cenc.encryption_index) {
// If this stream isn't encrypted, don't create the index.
if (!(*sc)->cenc.default_encrypted_sample)
return 0;
(*sc)->cenc.encryption_index = av_mallocz(sizeof(*frag_stream_info->encryption_index)); (*sc)->cenc.encryption_index = av_mallocz(sizeof(*frag_stream_info->encryption_index));
if (!(*sc)->cenc.encryption_index) if (!(*sc)->cenc.encryption_index)
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