diff mbox

[FFmpeg-devel] lavf/cafdec: Do not fail for unknown atoms with negative size.

Message ID CAB0OVGo4j6FbeJauMVM0T1r_5y0j7b4wMz1tAsfVOaTO8KYQDw@mail.gmail.com
State Superseded
Headers show

Commit Message

Carl Eugen Hoyos Jan. 23, 2019, 10:26 p.m. UTC
Hi!

Attached patch allows to read a user's file that plays fine with QT.
The patch duplicates the behaviour of QT.

Please comment, Carl Eugen

Comments

Paul B Mahol Jan. 25, 2019, 4:49 p.m. UTC | #1
On 1/23/19, Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
> Hi!
>
> Attached patch allows to read a user's file that plays fine with QT.
> The patch duplicates the behaviour of QT.
>
> Please comment, Carl Eugen
>

lgtm
diff mbox

Patch

From f0bf67a089cd1e321f6947be252b38b439e0aa7f Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Date: Wed, 23 Jan 2019 23:22:57 +0100
Subject: [PATCH] lavf/cafdec: Do not fail for unknown atoms with negative
 size.

The specification requires the demuxer to only read the data
atom up to its given size, this is necessary as atoms are
allowed at the end of the file.
This patch duplicates the behaviour of the QuickTime player.
---
 libavformat/cafdec.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c
index 7652d9e..1731997 100644
--- a/libavformat/cafdec.c
+++ b/libavformat/cafdec.c
@@ -310,6 +310,8 @@  static int read_header(AVFormatContext *s)
                    "skipping CAF chunk: %08"PRIX32" (%s), size %"PRId64"\n",
                    tag, av_fourcc2str(av_bswap32(tag)), size);
         case MKBETAG('f','r','e','e'):
+            if (size < 0 && found_data)
+                break;
             if (size < 0)
                 return AVERROR_INVALIDDATA;
             break;
-- 
1.7.10.4