From e6fb844f7b736e72da364032d251283bce9e63ad Mon Sep 17 00:00:00 2001 From: Vittorio Giovara Date: Thu, 9 Apr 2015 18:11:10 +0200 Subject: Implement shared parsing of INFO tag in Canopus family Add some bounds checking to CLLC; reduce HQX variable scoping, add an error message. --- libavcodec/cllc.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'libavcodec/cllc.c') diff --git a/libavcodec/cllc.c b/libavcodec/cllc.c index f081c68612..578299fcae 100644 --- a/libavcodec/cllc.c +++ b/libavcodec/cllc.c @@ -24,6 +24,7 @@ #include "libavutil/intreadwrite.h" #include "bswapdsp.h" +#include "canopus.h" #include "get_bits.h" #include "avcodec.h" #include "internal.h" @@ -362,7 +363,11 @@ static int cllc_decode_frame(AVCodecContext *avctx, void *data, GetBitContext gb; int coding_type, ret; - /* Skip the INFO header if present */ + if (avpkt->size < 4 + 4) { + av_log(avctx, AV_LOG_ERROR, "Frame is too small %d.\n", avpkt->size); + return AVERROR_INVALIDDATA; + } + info_offset = 0; info_tag = AV_RL32(src); if (info_tag == MKTAG('I', 'N', 'F', 'O')) { @@ -373,11 +378,10 @@ static int cllc_decode_frame(AVCodecContext *avctx, void *data, info_offset); return AVERROR_INVALIDDATA; } + ff_canopus_parse_info_tag(avctx, src + 8, info_offset); info_offset += 8; src += info_offset; - - av_log(avctx, AV_LOG_DEBUG, "Skipping INFO chunk.\n"); } data_size = (avpkt->size - info_offset) & ~1; -- cgit v1.2.3