aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/h264_cabac.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-01-31 04:20:24 +0100
committerVittorio Giovara <vittorio.giovara@gmail.com>2015-02-22 23:49:34 +0000
commit07db7a0dd8239e255c08800162eb45b82c2c49fe (patch)
tree008acb26bb810b8bb6e0b63a5e9f80afea44789a /libavcodec/h264_cabac.c
parent2d1309c3528f89bfafe1298badf39fe7a1be0542 (diff)
downloadffmpeg-07db7a0dd8239e255c08800162eb45b82c2c49fe.tar.gz
h264_cabac: Break infinite loops
This fixes out of array reads and/or infinite loops. 30 is the maximum number of bits that can be read into coeff_abs below. CC: libav-stable@libav.org Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavcodec/h264_cabac.c')
-rw-r--r--libavcodec/h264_cabac.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/h264_cabac.c b/libavcodec/h264_cabac.c
index f1ab97a144..cce6450b0f 100644
--- a/libavcodec/h264_cabac.c
+++ b/libavcodec/h264_cabac.c
@@ -1711,7 +1711,7 @@ decode_cabac_residual_internal(H264Context *h, int16_t *block,
\
if( coeff_abs >= 15 ) { \
int j = 0; \
- while( get_cabac_bypass( CC ) ) { \
+ while (get_cabac_bypass(CC) && j < 30) { \
j++; \
} \
\