diff options
author | James Almer <jamrial@gmail.com> | 2017-10-23 02:29:53 +0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2017-10-26 06:26:08 +0300 |
commit | 6bd665b7c5798803366b877903fa3bce7f129d05 (patch) | |
tree | 599450b1996076a58c703e17167c696ba3482d8b /libavformat/takdec.c | |
parent | 984b882b769cab6372454cf8d5cda7c554c5ee77 (diff) |
avcodec/tak: remove GetBitContext usage from avpriv_tak_parse_streaminfo()
This prevents potential ABI issues with GetBitContext.
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavformat/takdec.c')
-rw-r--r-- | libavformat/takdec.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libavformat/takdec.c b/libavformat/takdec.c index 1535bec64f..6fda35c1be 100644 --- a/libavformat/takdec.c +++ b/libavformat/takdec.c @@ -103,7 +103,6 @@ static int tak_read_header(AVFormatContext *s) } } - init_get_bits8(&gb, buffer, size - 3); break; case TAK_METADATA_MD5: { uint8_t md5[16]; @@ -145,7 +144,9 @@ static int tak_read_header(AVFormatContext *s) if (type == TAK_METADATA_STREAMINFO) { TAKStreamInfo ti; - avpriv_tak_parse_streaminfo(&gb, &ti); + ret = avpriv_tak_parse_streaminfo(&ti, buffer, size -3); + if (ret < 0) + return AVERROR_INVALIDDATA; if (ti.samples > 0) st->duration = ti.samples; st->codecpar->bits_per_coded_sample = ti.bps; @@ -161,11 +162,13 @@ static int tak_read_header(AVFormatContext *s) } else if (type == TAK_METADATA_LAST_FRAME) { if (size != 11) return AVERROR_INVALIDDATA; + init_get_bits8(&gb, buffer, size - 3); tc->mlast_frame = 1; tc->data_end = get_bits64(&gb, TAK_LAST_FRAME_POS_BITS) + get_bits(&gb, TAK_LAST_FRAME_SIZE_BITS); av_freep(&buffer); } else if (type == TAK_METADATA_ENCODER) { + init_get_bits8(&gb, buffer, size - 3); av_log(s, AV_LOG_VERBOSE, "encoder version: %0X\n", get_bits_long(&gb, TAK_ENCODER_VERSION_BITS)); av_freep(&buffer); |