diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-05-30 16:42:01 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-05-30 16:42:01 +0200 |
commit | 39f0a45a1a087e5bbef84fa3366942384ec32155 (patch) | |
tree | 013602605c13a7587c35da3a3d043f843b9ba8b9 /libavcodec/h264_cavlc.c | |
parent | 32e60b6bfed709a7d84fd35942baee12a6080595 (diff) | |
download | ffmpeg-39f0a45a1a087e5bbef84fa3366942384ec32155.tar.gz |
h264_cavlc: check prefix before using it.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/h264_cavlc.c')
-rw-r--r-- | libavcodec/h264_cavlc.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/h264_cavlc.c b/libavcodec/h264_cavlc.c index a4debade2e..2d62baa13c 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; |