aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-05-08 11:55:27 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2017-05-14 00:21:49 +0200
commit88893627a1c646461f1e35b87c1d6b804bc63b91 (patch)
tree146c070c62e41a6b67d62bd5afbbc915f5f0ef20 /libavcodec
parenta483e46b794539d21b1ec0f3e521f681a54a86d2 (diff)
downloadffmpeg-88893627a1c646461f1e35b87c1d6b804bc63b91.tar.gz
avcodec/cavsdec: Check sym_factor
Fixes: runtime error: signed integer overflow: 25984 * 130560 cannot be represented in type 'int' Fixes: 1404/clusterfuzz-testcase-minimized-5000441286885376 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 279420b5a63b3f254e4932a4afb91759fb50186a) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/cavsdec.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/cavsdec.c b/libavcodec/cavsdec.c
index 4d3d2d7c65..eb2464f36d 100644
--- a/libavcodec/cavsdec.c
+++ b/libavcodec/cavsdec.c
@@ -1031,6 +1031,10 @@ static int decode_pic(AVSContext *h)
h->scale_den[1] = h->dist[1] ? 512/h->dist[1] : 0;
if (h->cur.f->pict_type == AV_PICTURE_TYPE_B) {
h->sym_factor = h->dist[0] * h->scale_den[1];
+ if (FFABS(h->sym_factor) > 32768) {
+ av_log(h->avctx, AV_LOG_ERROR, "sym_factor %d too large\n", h->sym_factor);
+ return AVERROR_INVALIDDATA;
+ }
} else {
h->direct_den[0] = h->dist[0] ? 16384 / h->dist[0] : 0;
h->direct_den[1] = h->dist[1] ? 16384 / h->dist[1] : 0;