aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-08-30 02:12:10 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-09-07 13:40:22 +0200
commitd76c9b5665a87be003adf9c88cbc902099c90fc4 (patch)
treecb302342ec22315b8d08984fbb7c814b176fbec3
parentd4253b3a5b7431053810844323a5cb4ea0293810 (diff)
downloadffmpeg-d76c9b5665a87be003adf9c88cbc902099c90fc4.tar.gz
avcodec/snow: check coeffs for validity
Fixes deadlock Fixes integer overflow Fixes Ticket 3892 Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit 596636a474ab201badaae269f3a2cef4824b8c1f) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/snow.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/libavcodec/snow.h b/libavcodec/snow.h
index 6335c5d8ae..dace5e39cf 100644
--- a/libavcodec/snow.h
+++ b/libavcodec/snow.h
@@ -654,7 +654,10 @@ static inline void unpack_coeffs(SnowContext *s, SubBand *b, SubBand * parent, i
if(v){
v= 2*(get_symbol2(&s->c, b->state[context + 2], context-4) + 1);
v+=get_rac(&s->c, &b->state[0][16 + 1 + 3 + ff_quant3bA[l&0xFF] + 3*ff_quant3bA[t&0xFF]]);
-
+ if ((uint16_t)v != v) {
+ av_log(s->avctx, AV_LOG_ERROR, "Coefficient damaged\n");
+ v = 1;
+ }
xc->x=x;
(xc++)->coeff= v;
}
@@ -664,6 +667,10 @@ static inline void unpack_coeffs(SnowContext *s, SubBand *b, SubBand * parent, i
else run= INT_MAX;
v= 2*(get_symbol2(&s->c, b->state[0 + 2], 0-4) + 1);
v+=get_rac(&s->c, &b->state[0][16 + 1 + 3]);
+ if ((uint16_t)v != v) {
+ av_log(s->avctx, AV_LOG_ERROR, "Coefficient damaged\n");
+ v = 1;
+ }
xc->x=x;
(xc++)->coeff= v;