diff options
author | Peter Ross <pross@xvid.org> | 2010-10-10 00:50:37 +0000 |
---|---|---|
committer | Peter Ross <pross@xvid.org> | 2010-10-10 00:50:37 +0000 |
commit | 1e6f8d53fc8153da17ed2e6f2a0bde5a1b8d3419 (patch) | |
tree | 8e1f0755bea352923c6a08960a9bcd8dbe5959a3 /libavformat/cafdec.c | |
parent | 47a5fba7738607391baf1fb78cfb39273b417ec7 (diff) | |
download | ffmpeg-1e6f8d53fc8153da17ed2e6f2a0bde5a1b8d3419.tar.gz |
cafdec: Handle ALAC extradata.
This fixes roundup issue 2284.
Originally committed as revision 25430 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/cafdec.c')
-rw-r--r-- | libavformat/cafdec.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c index c020579551..201c5f2e96 100644 --- a/libavformat/cafdec.c +++ b/libavformat/cafdec.c @@ -115,6 +115,21 @@ static int read_kuki_chunk(AVFormatContext *s, int64_t size) return AVERROR_INVALIDDATA; } url_fskip(pb, skip); + } else if (st->codec->codec_id == CODEC_ID_ALAC) { +#define ALAC_PREAMBLE 12 +#define ALAC_HEADER 36 + if (size < ALAC_PREAMBLE + ALAC_HEADER) { + av_log(s, AV_LOG_ERROR, "invalid ALAC magic cookie\n"); + url_fskip(pb, size); + return AVERROR_INVALIDDATA; + } + url_fskip(pb, ALAC_PREAMBLE); + st->codec->extradata = av_mallocz(ALAC_HEADER + FF_INPUT_BUFFER_PADDING_SIZE); + if (!st->codec->extradata) + return AVERROR(ENOMEM); + get_buffer(pb, st->codec->extradata, ALAC_HEADER); + st->codec->extradata_size = ALAC_HEADER; + url_fskip(pb, size - ALAC_PREAMBLE - ALAC_HEADER); } else { st->codec->extradata = av_mallocz(size + FF_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) |