diff mbox

[FFmpeg-devel] avformat/mov: Allow saio/saiz in clear content.

Message ID CAO7y9i82cGLmBNXpHWCLVncN3sTfkbMQSQpLgN9_LuaN5bjXEA@mail.gmail.com
State New
Headers show

Commit Message

Jacob Trimble Aug. 20, 2018, 5:56 p.m. UTC
On Wed, Aug 15, 2018 at 2:38 PM Michael Niedermayer
<michael@niedermayer.cc> wrote:
>
> [...]
>
> >  mov.c |    6 ++++++
> >  1 file changed, 6 insertions(+)
> > 0e583b4ad11852ce38a2b945644e178b7f13a42f  0001-avformat-mov-Allow-saio-saiz-in-clear-content-v2.patch
> > From 256880aca517f64257eb28342a656867d90307a7 Mon Sep 17 00:00:00 2001
> > From: Jacob Trimble <modmaker@google.com>
> > Date: Tue, 14 Aug 2018 10:18:55 -0700
> > Subject: [PATCH] avformat/mov: Allow saio/saiz in clear content.
>
> This code is used in saio/saiz/senc. The message only mentions the first
> 2.
>

senc shouldn't appear in clear content, so it shouldn't change
anything.  Changed the commit message to include that.

>
> [...]
>
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Whats the most studid thing your enemy could do ? Blow himself up
> Whats the most studid thing you could do ? Give up your rights and
> freedom because your enemy blew himself up.
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Comments

Michael Niedermayer Aug. 22, 2018, 12:36 a.m. UTC | #1
On Mon, Aug 20, 2018 at 10:56:04AM -0700, Jacob Trimble wrote:
> On Wed, Aug 15, 2018 at 2:38 PM Michael Niedermayer
> <michael@niedermayer.cc> wrote:
> >
> > [...]
> >
> > >  mov.c |    6 ++++++
> > >  1 file changed, 6 insertions(+)
> > > 0e583b4ad11852ce38a2b945644e178b7f13a42f  0001-avformat-mov-Allow-saio-saiz-in-clear-content-v2.patch
> > > From 256880aca517f64257eb28342a656867d90307a7 Mon Sep 17 00:00:00 2001
> > > From: Jacob Trimble <modmaker@google.com>
> > > Date: Tue, 14 Aug 2018 10:18:55 -0700
> > > Subject: [PATCH] avformat/mov: Allow saio/saiz in clear content.
> >
> > This code is used in saio/saiz/senc. The message only mentions the first
> > 2.
> >
> 
> senc shouldn't appear in clear content, so it shouldn't change
> anything.  Changed the commit message to include that.

will apply

thanks


[...]
diff mbox

Patch

From 18e6aba25364b988ac52413949f62eef03d6c648 Mon Sep 17 00:00:00 2001
From: Jacob Trimble <modmaker@google.com>
Date: Tue, 14 Aug 2018 10:18:55 -0700
Subject: [PATCH] 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/873432

Signed-off-by: Jacob Trimble <modmaker@google.com>
---
 libavformat/mov.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index c863047d79..ee9acdb73c 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -5847,6 +5847,9 @@  static int get_current_encryption_info(MOVContext *c, MOVEncryptionIndex **encry
         *sc = st->priv_data;
 
         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));
             if (!frag_stream_info->encryption_index)
                 return AVERROR(ENOMEM);
@@ -5862,6 +5865,9 @@  static int get_current_encryption_info(MOVContext *c, MOVEncryptionIndex **encry
         *sc = st->priv_data;
 
         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));
             if (!(*sc)->cenc.encryption_index)
                 return AVERROR(ENOMEM);
-- 
2.18.0.865.gffc8e1a3cd6-goog