diff options
author | Martin Storsjö <martin@martin.st> | 2013-09-11 16:54:20 +0400 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2013-09-11 21:20:45 +0400 |
commit | 0679cec6e8802643bbe6d5f68ca1110a7d3171da (patch) | |
tree | a38f2c3134eb36f678818a3c248f0e3ac9b07190 | |
parent | d002fce24a7206e95f9492031f45adc35711e183 (diff) |
smacker: Make sure we don't fill in huffman codes out of range
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
-rw-r--r-- | libavcodec/smacker.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c index d33c223dcf..9819fa58cc 100644 --- a/libavcodec/smacker.c +++ b/libavcodec/smacker.c @@ -268,6 +268,12 @@ static int smacker_decode_header_tree(SmackVContext *smk, GetBitContext *gb, int if(ctx.last[0] == -1) ctx.last[0] = huff.current++; if(ctx.last[1] == -1) ctx.last[1] = huff.current++; if(ctx.last[2] == -1) ctx.last[2] = huff.current++; + if (ctx.last[0] >= huff.length || + ctx.last[1] >= huff.length || + ctx.last[2] >= huff.length) { + av_log(smk->avctx, AV_LOG_ERROR, "Huffman codes out of range\n"); + err = AVERROR_INVALIDDATA; + } *recodes = huff.values; |