diff mbox series

[FFmpeg-devel] avformat/mov: Ignore multiple STSC / STCO

Message ID 20210324182430.10748-1-michael@niedermayer.cc
State Accepted
Commit 2611d20d353026f996cb9aaced8b35db37f490d4
Headers show
Series [FFmpeg-devel] avformat/mov: Ignore multiple STSC / STCO
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Michael Niedermayer March 24, 2021, 6:24 p.m. UTC
Fixes: STSC / STCO inconsistency and assertion failure
Fixes: crbug1184666.mp4

Found-by: Chromium ASAN fuzzer
Reviewed-by: Matt Wolenetz <wolenetz@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/mov.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

Comments

Michael Niedermayer March 31, 2021, 6:49 p.m. UTC | #1
On Wed, Mar 24, 2021 at 07:24:30PM +0100, Michael Niedermayer wrote:
> Fixes: STSC / STCO inconsistency and assertion failure
> Fixes: crbug1184666.mp4
> 
> Found-by: Chromium ASAN fuzzer
> Reviewed-by: Matt Wolenetz <wolenetz@google.com>
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/mov.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)

will apply

[...]
diff mbox series

Patch

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 5f8bcfbf22..69d44a64b5 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2037,8 +2037,10 @@  static int mov_read_stco(MOVContext *c, AVIOContext *pb, MOVAtom atom)
     if (!entries)
         return 0;
 
-    if (sc->chunk_offsets)
-        av_log(c->fc, AV_LOG_WARNING, "Duplicated STCO atom\n");
+    if (sc->chunk_offsets) {
+        av_log(c->fc, AV_LOG_WARNING, "Ignoring duplicated STCO atom\n");
+        return 0;
+    }
     av_free(sc->chunk_offsets);
     sc->chunk_count = 0;
     sc->chunk_offsets = av_malloc_array(entries, sizeof(*sc->chunk_offsets));
@@ -2671,8 +2673,10 @@  static int mov_read_stsc(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
     if (!entries)
         return 0;
-    if (sc->stsc_data)
-        av_log(c->fc, AV_LOG_WARNING, "Duplicated STSC atom\n");
+    if (sc->stsc_data) {
+        av_log(c->fc, AV_LOG_WARNING, "Ignoring duplicated STSC atom\n");
+        return 0;
+    }
     av_free(sc->stsc_data);
     sc->stsc_count = 0;
     sc->stsc_data = av_malloc_array(entries, sizeof(*sc->stsc_data));