aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-09-30 08:02:11 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2020-01-06 11:30:43 +0100
commit45836a60f5b6326c7896a413e651aa35c8cc45dc (patch)
tree771ba8b3b56d0b67077d9bd3c02046c48b0666b2
parent5e3a827e9dc49ad75d533ece396ecec81674f586 (diff)
downloadffmpeg-45836a60f5b6326c7896a413e651aa35c8cc45dc.tar.gz
avcodec/dxv: Check op_offset in dxv_decompress_yo()
Fixes: signed integer overflow: -2147483648 - 8 cannot be represented in type 'int' Fixes: 17745/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DXV_fuzzer-5734628463214592 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 97450d2b6a08769cbc4665bc66f6db9e8c5da2a4) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/dxv.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/dxv.c b/libavcodec/dxv.c
index 03e8270463..c6866f18e6 100644
--- a/libavcodec/dxv.c
+++ b/libavcodec/dxv.c
@@ -797,6 +797,9 @@ static int dxv_decompress_yo(DXVContext *ctx, GetByteContext *gb,
uint8_t *dst, *table0[256] = { 0 }, *table1[256] = { 0 };
int ret, state = 0, skip, oi = 0, v, vv;
+ if (op_offset < 8 || op_offset - 8 > bytestream2_get_bytes_left(gb))
+ return AVERROR_INVALIDDATA;
+
dst = tex_data;
bytestream2_skip(gb, op_offset - 8);
if (op_size > max_op_size)