summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Eugen Hoyos <ceffmpeg@gmail.com>2019-01-15 00:22:50 +0100
committerCarl Eugen Hoyos <ceffmpeg@gmail.com>2019-01-27 14:14:59 +0100
commit8a788ff5d635c7fdd8104d82970eb0ae29ae799e (patch)
treef15eca5f2dad727484d9a361fee68d87cbb6cfb5
parent795af110f70bbd12b45ae2d3b08e7f45db5224a0 (diff)
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.
-rw-r--r--libavformat/cafdec.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c
index 7652d9e238..20956bcf97 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)
+ goto found_data;
if (size < 0)
return AVERROR_INVALIDDATA;
break;
@@ -325,6 +327,7 @@ static int read_header(AVFormatContext *s)
if (!found_data)
return AVERROR_INVALIDDATA;
+found_data:
if (caf->bytes_per_packet > 0 && caf->frames_per_packet > 0) {
if (caf->data_size > 0)
st->nb_frames = (caf->data_size / caf->bytes_per_packet) * caf->frames_per_packet;