提交 8a788ff5 编写于 作者: C Carl Eugen Hoyos

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.
上级 795af110
...@@ -310,6 +310,8 @@ static int read_header(AVFormatContext *s) ...@@ -310,6 +310,8 @@ static int read_header(AVFormatContext *s)
"skipping CAF chunk: %08"PRIX32" (%s), size %"PRId64"\n", "skipping CAF chunk: %08"PRIX32" (%s), size %"PRId64"\n",
tag, av_fourcc2str(av_bswap32(tag)), size); tag, av_fourcc2str(av_bswap32(tag)), size);
case MKBETAG('f','r','e','e'): case MKBETAG('f','r','e','e'):
if (size < 0 && found_data)
goto found_data;
if (size < 0) if (size < 0)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
break; break;
...@@ -325,6 +327,7 @@ static int read_header(AVFormatContext *s) ...@@ -325,6 +327,7 @@ static int read_header(AVFormatContext *s)
if (!found_data) if (!found_data)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
found_data:
if (caf->bytes_per_packet > 0 && caf->frames_per_packet > 0) { if (caf->bytes_per_packet > 0 && caf->frames_per_packet > 0) {
if (caf->data_size > 0) if (caf->data_size > 0)
st->nb_frames = (caf->data_size / caf->bytes_per_packet) * caf->frames_per_packet; st->nb_frames = (caf->data_size / caf->bytes_per_packet) * caf->frames_per_packet;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册