aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/ivi_common.c
diff options
context:
space:
mode:
authorKostya Shishkov <kostya.shishkov@gmail.com>2012-05-19 12:39:49 +0200
committerReinhard Tartler <siretart@tauware.de>2013-01-04 07:43:37 +0100
commitc0df6a24ce9e1557208c33a907346e2d709b1816 (patch)
tree651adc79c3efe18b7f212b87c0b1bf17fe22d243 /libavcodec/ivi_common.c
parent2d63f9b4effc062138537190d4b9201d5e51cb8d (diff)
downloadffmpeg-c0df6a24ce9e1557208c33a907346e2d709b1816.tar.gz
indeo: check custom Huffman tables for errors
(cherry picked from commit fe7a37c36febd71576cbefc385d995a8d6e444e7) Signed-off-by: Reinhard Tartler <siretart@tauware.de>
Diffstat (limited to 'libavcodec/ivi_common.c')
-rw-r--r--libavcodec/ivi_common.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libavcodec/ivi_common.c b/libavcodec/ivi_common.c
index bd3d4e6fd4..dac8d696d4 100644
--- a/libavcodec/ivi_common.c
+++ b/libavcodec/ivi_common.c
@@ -123,6 +123,10 @@ int ff_ivi_dec_huff_desc(GetBitContext *gb, int desc_coded, int which_tab,
if (huff_tab->tab_sel == 7) {
/* custom huffman table (explicitly encoded) */
new_huff.num_rows = get_bits(gb, 4);
+ if (!new_huff.num_rows) {
+ av_log(avctx, AV_LOG_ERROR, "Empty custom Huffman table!\n");
+ return AVERROR_INVALIDDATA;
+ }
for (i = 0; i < new_huff.num_rows; i++)
new_huff.xbits[i] = get_bits(gb, 4);
@@ -136,9 +140,10 @@ int ff_ivi_dec_huff_desc(GetBitContext *gb, int desc_coded, int which_tab,
result = ff_ivi_create_huff_from_desc(&huff_tab->cust_desc,
&huff_tab->cust_tab, 0);
if (result) {
+ huff_tab->cust_desc.num_rows = 0; // reset faulty description
av_log(avctx, AV_LOG_ERROR,
"Error while initializing custom vlc table!\n");
- return -1;
+ return result;
}
}
huff_tab->tab = &huff_tab->cust_tab;