Commit 48cbdaea authored by Michael Niedermayer's avatar Michael Niedermayer

smacker: fix smacker_decode_header_tree() empty vlc table init

Fixes Ticket1858
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent e6305f76
...@@ -207,27 +207,33 @@ static int smacker_decode_header_tree(SmackVContext *smk, GetBitContext *gb, int ...@@ -207,27 +207,33 @@ static int smacker_decode_header_tree(SmackVContext *smk, GetBitContext *gb, int
if(get_bits1(gb)) { if(get_bits1(gb)) {
smacker_decode_tree(gb, &tmp1, 0, 0); smacker_decode_tree(gb, &tmp1, 0, 0);
skip_bits1(gb); skip_bits1(gb);
res = init_vlc(&vlc[0], SMKTREE_BITS, tmp1.length, if(tmp1.current > 1) {
tmp1.lengths, sizeof(int), sizeof(int), res = init_vlc(&vlc[0], SMKTREE_BITS, tmp1.length,
tmp1.bits, sizeof(uint32_t), sizeof(uint32_t), INIT_VLC_LE); tmp1.lengths, sizeof(int), sizeof(int),
if(res < 0) { tmp1.bits, sizeof(uint32_t), sizeof(uint32_t), INIT_VLC_LE);
av_log(smk->avctx, AV_LOG_ERROR, "Cannot build VLC table\n"); if(res < 0) {
return AVERROR_INVALIDDATA; av_log(smk->avctx, AV_LOG_ERROR, "Cannot build VLC table\n");
return AVERROR_INVALIDDATA;
}
} }
} else { }
if (!vlc[0].table) {
av_log(smk->avctx, AV_LOG_ERROR, "Skipping low bytes tree\n"); av_log(smk->avctx, AV_LOG_ERROR, "Skipping low bytes tree\n");
} }
if(get_bits1(gb)){ if(get_bits1(gb)){
smacker_decode_tree(gb, &tmp2, 0, 0); smacker_decode_tree(gb, &tmp2, 0, 0);
skip_bits1(gb); skip_bits1(gb);
res = init_vlc(&vlc[1], SMKTREE_BITS, tmp2.length, if(tmp2.current > 1) {
tmp2.lengths, sizeof(int), sizeof(int), res = init_vlc(&vlc[1], SMKTREE_BITS, tmp2.length,
tmp2.bits, sizeof(uint32_t), sizeof(uint32_t), INIT_VLC_LE); tmp2.lengths, sizeof(int), sizeof(int),
if(res < 0) { tmp2.bits, sizeof(uint32_t), sizeof(uint32_t), INIT_VLC_LE);
av_log(smk->avctx, AV_LOG_ERROR, "Cannot build VLC table\n"); if(res < 0) {
return AVERROR_INVALIDDATA; av_log(smk->avctx, AV_LOG_ERROR, "Cannot build VLC table\n");
return AVERROR_INVALIDDATA;
}
} }
} else { }
if (!vlc[1].table) {
av_log(smk->avctx, AV_LOG_ERROR, "Skipping high bytes tree\n"); av_log(smk->avctx, AV_LOG_ERROR, "Skipping high bytes tree\n");
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment