aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-10-13 03:06:54 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2017-10-15 00:45:28 +0200
commit209bd75519a3177c8411c0dc42984cc885be92c9 (patch)
tree7d2dfad08e1b8c2b996eedbae6339af3a55db158
parent453da701192a7bb77fd7d85af9e7a5e04dfd19e9 (diff)
downloadffmpeg-209bd75519a3177c8411c0dc42984cc885be92c9.tar.gz
avcodec/snowdec: Check mv_scale
Fixes: runtime error: signed integer overflow: 2 * -1094995530 cannot be represented in type 'int' Fixes: 3512/clusterfuzz-testcase-minimized-4812747210489856 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 393d6fc7395611a38792e3c271b2be42ac45e672) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/snowdec.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/snowdec.c b/libavcodec/snowdec.c
index b139e5c5aa..a95a5e398e 100644
--- a/libavcodec/snowdec.c
+++ b/libavcodec/snowdec.c
@@ -369,9 +369,10 @@ static int decode_header(SnowContext *s){
s->mv_scale += get_symbol(&s->c, s->header_state, 1);
s->qbias += get_symbol(&s->c, s->header_state, 1);
s->block_max_depth+= get_symbol(&s->c, s->header_state, 1);
- if(s->block_max_depth > 1 || s->block_max_depth < 0){
+ if(s->block_max_depth > 1 || s->block_max_depth < 0 || s->mv_scale > 256U){
av_log(s->avctx, AV_LOG_ERROR, "block_max_depth= %d is too large\n", s->block_max_depth);
s->block_max_depth= 0;
+ s->mv_scale = 0;
return AVERROR_INVALIDDATA;
}
if (FFABS(s->qbias) > 127) {