aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/bitstream.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-03-23 11:38:20 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-03-23 11:38:53 +0100
commit2e909b3c77d0d39d4f30aba8b6a780c979551e38 (patch)
treec4d76d57f236d91568bac647c1c32870e7d161f3 /libavcodec/bitstream.c
parentaae44fb4cdfab4fae4d981d2fe1fd708f1dcf9bb (diff)
downloadffmpeg-2e909b3c77d0d39d4f30aba8b6a780c979551e38.tar.gz
bitstream: build_table, check table_nb_bits.
Fixes null ptr deref. Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/bitstream.c')
-rw-r--r--libavcodec/bitstream.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavcodec/bitstream.c b/libavcodec/bitstream.c
index aad5ffa2fb..506eb336a0 100644
--- a/libavcodec/bitstream.c
+++ b/libavcodec/bitstream.c
@@ -157,6 +157,8 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes,
VLC_TYPE (*table)[2];
table_size = 1 << table_nb_bits;
+ if (table_nb_bits > 30)
+ return -1;
table_index = alloc_table(vlc, table_size, flags & INIT_VLC_USE_NEW_STATIC);
av_dlog(NULL, "new table index=%d size=%d\n", table_index, table_size);
if (table_index < 0)