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>
This commit is contained in:
Michael Niedermayer 2012-03-23 11:38:20 +01:00
parent aae44fb4cd
commit 2e909b3c77
1 changed files with 2 additions and 0 deletions

View File

@ -157,6 +157,8 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes,
VLC_TYPE (*table)[2]; VLC_TYPE (*table)[2];
table_size = 1 << table_nb_bits; 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); 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); av_dlog(NULL, "new table index=%d size=%d\n", table_index, table_size);
if (table_index < 0) if (table_index < 0)