aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Foucu <tfoucu@gmail.com>2011-11-17 09:39:52 -0800
committerMichael Niedermayer <michaelni@gmx.at>2011-11-21 21:57:09 +0100
commit0cd61bfa6d6ecf2ab57da8496858473158c4ea35 (patch)
tree4e71dfa9a3f7dcaad548343b49dd7022c2175776
parent16ea6af381906281c0db89ee0356a9553c41339d (diff)
downloadffmpeg-0cd61bfa6d6ecf2ab57da8496858473158c4ea35.tar.gz
vp6: Fix illegal read.
Found with Address Sanitizer Signed-off-by: Alex Converse <alex.converse@gmail.com> (cherry picked from commit e0966eb140b3569b3d6b5b5008961944ef229c06) Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit 8a63deab15ef41fd439be1b46d8dcb73669ccfc1) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/vp6.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/libavcodec/vp6.c b/libavcodec/vp6.c
index 5071903701..b89ff498da 100644
--- a/libavcodec/vp6.c
+++ b/libavcodec/vp6.c
@@ -427,7 +427,8 @@ static void vp6_parse_coeff(VP56Context *s)
model1 = model->coeff_dccv[pt];
model2 = model->coeff_dcct[pt][ctx];
- for (coeff_idx=0; coeff_idx<64; ) {
+ coeff_idx = 0;
+ for (;;) {
if ((coeff_idx>1 && ct==0) || vp56_rac_get_prob(c, model2[0])) {
/* parse a coeff */
if (vp56_rac_get_prob(c, model2[2])) {
@@ -468,8 +469,10 @@ static void vp6_parse_coeff(VP56Context *s)
run += vp56_rac_get_prob(c, model3[i+8]) << i;
}
}
-
- cg = vp6_coeff_groups[coeff_idx+=run];
+ coeff_idx += run;
+ if (coeff_idx >= 64)
+ break;
+ cg = vp6_coeff_groups[coeff_idx];
model1 = model2 = model->coeff_ract[pt][ct][cg];
}