diff mbox

[FFmpeg-devel] avformat/mov: Fix reading saio/saiz for clear content.

Message ID 20180607173633.127204-1-modmaker@google.com
State Superseded
Headers show

Commit Message

Jacob Trimble June 7, 2018, 5:36 p.m. UTC
Found by Chrome's ClusterFuzz: http://crbug.com/850389

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

Patch

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 4ad19122b3..d07171b3f4 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -6041,6 +6041,11 @@  static int mov_read_saiz(MOVContext *c, AVIOContext *pb, MOVAtom atom)
     if (ret != 1)
         return ret;
 
+    if (!sc->cenc.default_encrypted_sample) {
+        // Didn't see a 'schm' or 'tenc' atom, so it isn't encrypted.
+        return 0;
+    }
+
     if (encryption_index->nb_encrypted_samples) {
         // This can happen if we have both saio/saiz and senc atoms.
         av_log(c->fc, AV_LOG_DEBUG, "Ignoring duplicate encryption info in saiz\n");
@@ -6095,6 +6100,11 @@  static int mov_read_saio(MOVContext *c, AVIOContext *pb, MOVAtom atom)
     if (ret != 1)
         return ret;
 
+    if (!sc->cenc.default_encrypted_sample) {
+        // Didn't see a 'schm' or 'tenc' atom, so it isn't encrypted.
+        return 0;
+    }
+
     if (encryption_index->nb_encrypted_samples) {
         // This can happen if we have both saio/saiz and senc atoms.
         av_log(c->fc, AV_LOG_DEBUG, "Ignoring duplicate encryption info in saio\n");