diff mbox series

[FFmpeg-devel,1/2] avformat/mov: Check STCO location

Message ID 20200111132723.16016-1-michael@niedermayer.cc
State Accepted
Headers show
Series [FFmpeg-devel,1/2] avformat/mov: Check STCO location | expand

Checks

Context Check Description
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Michael Niedermayer Jan. 11, 2020, 1:27 p.m. UTC
Fixes: bypassing of checks and assertion failure
Fixes: asan_1003879.mp4

Found-by: Clusterfuzz + asan
Reported-by: Thomas Guilbert <tguilbert@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/mov.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Michael Niedermayer Jan. 30, 2020, 7:37 p.m. UTC | #1
On Sat, Jan 11, 2020 at 02:27:22PM +0100, Michael Niedermayer wrote:
> Fixes: bypassing of checks and assertion failure
> Fixes: asan_1003879.mp4
> 
> Found-by: Clusterfuzz + asan
> Reported-by: Thomas Guilbert <tguilbert@google.com>
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/mov.c | 4 ++++
>  1 file changed, 4 insertions(+)

will apply

[...]
diff mbox series

Patch

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 589576b529..75f098af09 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1976,6 +1976,10 @@  static int mov_read_stco(MOVContext *c, AVIOContext *pb, MOVAtom atom)
     MOVStreamContext *sc;
     unsigned int i, entries;
 
+    if (c->trak_index < 0) {
+        av_log(c->fc, AV_LOG_WARNING, "STCO outside TRAK\n");
+        return 0;
+    }
     if (c->fc->nb_streams < 1)
         return 0;
     st = c->fc->streams[c->fc->nb_streams-1];