[FFmpeg-cvslog] bitstream: build_table, check table_nb_bits.

Michael Niedermayer git at videolan.org
Fri Mar 23 12:25:38 CET 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Fri Mar 23 11:38:20 2012 +0100| [2e909b3c77d0d39d4f30aba8b6a780c979551e38] | committer: Michael Niedermayer

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 at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2e909b3c77d0d39d4f30aba8b6a780c979551e38
---

 libavcodec/bitstream.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/libavcodec/bitstream.c b/libavcodec/bitstream.c
index aad5ffa..506eb33 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)



More information about the ffmpeg-cvslog mailing list