aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/vb.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-06-28 20:29:02 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2017-07-19 02:48:39 +0200
commit20ce366feefc19db931ba26f3fe61c632fa0d484 (patch)
tree008d613e666d68a6b4fc2c82fc9ae009ca9c7f9a /libavcodec/vb.c
parentbbf911b660b9a23ed4dd1beb684b3940cc91be34 (diff)
downloadffmpeg-20ce366feefc19db931ba26f3fe61c632fa0d484.tar.gz
avcodec/vb: Check vertical GMC component before multiply
Fixes: runtime error: signed integer overflow: 8224 * 663584 cannot be represented in type 'int' Fixes: 2393/clusterfuzz-testcase-minimized-6128334993883136 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 bc6ab72bc7af27189e7b524b97e45c6fcadab5cf) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/vb.c')
-rw-r--r--libavcodec/vb.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/vb.c b/libavcodec/vb.c
index 560165adc7..021657f7d8 100644
--- a/libavcodec/vb.c
+++ b/libavcodec/vb.c
@@ -205,6 +205,10 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
if (flags & VB_HAS_GMC) {
i = (int16_t)bytestream2_get_le16(&c->stream);
j = (int16_t)bytestream2_get_le16(&c->stream);
+ if (FFABS(j) > avctx->height) {
+ av_log(avctx, AV_LOG_ERROR, "GMV out of range\n");
+ return AVERROR_INVALIDDATA;
+ }
offset = i + j * avctx->width;
}
if (flags & VB_HAS_VIDEO) {