summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorFederico Tomassetti <ftomassetti@groupon.com>2015-02-18 12:11:44 +0000
committerLuca Barbato <lu_zero@gentoo.org>2015-02-23 15:06:18 +0100
commit061c489895d29049a88dc6118e4b639a273b31d6 (patch)
tree485d575434e61cb674bb5f68d3ce57cebe79e13e /libavcodec
parent161442ff2c4b0dd8a5072c6bbe6bf55303fffccf (diff)
downloadffmpeg-061c489895d29049a88dc6118e4b639a273b31d6.tar.gz
eamad: check for out of bounds read
Bug-Id: CID 1257500 CC: libav-stable@libav.org Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/eamad.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/libavcodec/eamad.c b/libavcodec/eamad.c
index a226a83e29..a76d93508d 100644
--- a/libavcodec/eamad.c
+++ b/libavcodec/eamad.c
@@ -145,6 +145,11 @@ static inline void decode_block_intra(MadContext *s, int16_t * block)
break;
} else if (level != 0) {
i += run;
+ if (i > 63) {
+ av_log(s->avctx, AV_LOG_ERROR,
+ "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y);
+ return;
+ }
j = scantable[i];
level = (level*quant_matrix[j]) >> 4;
level = (level-1)|1;
@@ -159,6 +164,11 @@ static inline void decode_block_intra(MadContext *s, int16_t * block)
run = SHOW_UBITS(re, &s->gb, 6)+1; LAST_SKIP_BITS(re, &s->gb, 6);
i += run;
+ if (i > 63) {
+ av_log(s->avctx, AV_LOG_ERROR,
+ "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y);
+ return;
+ }
j = scantable[i];
if (level < 0) {
level = -level;
@@ -170,10 +180,6 @@ static inline void decode_block_intra(MadContext *s, int16_t * block)
level = (level-1)|1;
}
}
- if (i > 63) {
- av_log(s->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y);
- return;
- }
block[j] = level;
}