diff options
author | Vittorio Giovara <vittorio.giovara@gmail.com> | 2015-04-09 18:11:10 +0200 |
---|---|---|
committer | Vittorio Giovara <vittorio.giovara@gmail.com> | 2015-04-19 22:37:02 +0100 |
commit | e6fb844f7b736e72da364032d251283bce9e63ad (patch) | |
tree | d02472cd05911273fdff83ba345255ccadb07090 /libavcodec/cllc.c | |
parent | fcda30f2dcb744d89df9d5d1ec89ba55279cb83c (diff) | |
download | ffmpeg-e6fb844f7b736e72da364032d251283bce9e63ad.tar.gz |
Implement shared parsing of INFO tag in Canopus family
Add some bounds checking to CLLC; reduce HQX variable scoping,
add an error message.
Diffstat (limited to 'libavcodec/cllc.c')
-rw-r--r-- | libavcodec/cllc.c | 10 |
1 files changed, 7 insertions, 3 deletions
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; |