[FFmpeg-cvslog] h264_cavlc: check prefix before using it.

Michael Niedermayer git at videolan.org
Thu Jun 7 01:44:16 CEST 2012


ffmpeg | branch: release/0.11 | Michael Niedermayer <michaelni at gmx.at> | Wed May 30 16:42:01 2012 +0200| [dff4dbdf6035db4dfb0432f1fef44bb1afdef5c4] | committer: Michael Niedermayer

h264_cavlc: check prefix before using it.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit 39f0a45a1a087e5bbef84fa3366942384ec32155)

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavcodec/h264_cavlc.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/h264_cavlc.c b/libavcodec/h264_cavlc.c
index a4debad..2d62baa 100644
--- a/libavcodec/h264_cavlc.c
+++ b/libavcodec/h264_cavlc.c
@@ -513,7 +513,7 @@ static int decode_residual(H264Context *h, GetBitContext *gb, DCTELEM *block, in
                 else
                     level_code= prefix + get_bits(gb, 4); //part
             }else{
-                level_code= 30 + get_bits(gb, prefix-3); //part
+                level_code= 30;
                 if(prefix>=16){
                     if(prefix > 25+3){
                         av_log(h->s.avctx, AV_LOG_ERROR, "Invalid level prefix\n");
@@ -521,6 +521,7 @@ static int decode_residual(H264Context *h, GetBitContext *gb, DCTELEM *block, in
                     }
                     level_code += (1<<(prefix-3))-4096;
                 }
+                level_code += get_bits(gb, prefix-3); //part
             }
 
             if(trailing_ones < 3) level_code += 2;



More information about the ffmpeg-cvslog mailing list