X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Ftakdec.c;h=6fda35c1bef204888b92141669cba04d4cc8fa9d;hb=a33490ca2874ed88ffb7cd325f7fc28a02c7c186;hp=1535bec64f378749b82f4da53b51a52a812711a4;hpb=b773a8d8c1dfe4cfc6eabf509e26ab011270b9ed;p=ffmpeg diff --git a/libavformat/takdec.c b/libavformat/takdec.c index 1535bec64f3..6fda35c1bef 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);