[FFmpeg-devel] avcodec/dxv: Check op_offset in dxv_decompress_cocg()

Submitted by Michael Niedermayer on May 21, 2019, 12:22 a.m.

Details

Message ID 20190521002210.932-1-michael@niedermayer.cc
State Accepted
Commit 8e520843dd76a644c019134ac7b17eba9f1118b3
Headers show

Commit Message

Michael Niedermayer May 21, 2019, 12:22 a.m.
Fixes: signed integer overflow: -2147483648 - 12 cannot be represented in type 'int'
Fixes: 14732/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DXV_fuzzer-5735273129836544

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/dxv.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Michael Niedermayer June 5, 2019, 11:06 a.m.
On Tue, May 21, 2019 at 02:22:10AM +0200, Michael Niedermayer wrote:
> Fixes: signed integer overflow: -2147483648 - 12 cannot be represented in type 'int'
> Fixes: 14732/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DXV_fuzzer-5735273129836544
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/dxv.c | 3 +++
>  1 file changed, 3 insertions(+)

will apply

[...]

Patch hide | download patch | download mbox

diff --git a/libavcodec/dxv.c b/libavcodec/dxv.c
index 6fe5516505..5fd1844094 100644
--- a/libavcodec/dxv.c
+++ b/libavcodec/dxv.c
@@ -745,6 +745,9 @@  static int dxv_decompress_cocg(DXVContext *ctx, GetByteContext *gb,
     int skip0, skip1, oi0 = 0, oi1 = 0;
     int ret, state0 = 0, state1 = 0;
 
+    if (op_offset < 12)
+        return AVERROR_INVALIDDATA;
+
     dst = tex_data;
     bytestream2_skip(gb, op_offset - 12);
     if (op_size0 > max_op_size0)