diff mbox

[FFmpeg-devel,5/5] avcodec/dsicinvideo: Fail if there is only a small fraction of the data available that comprises a full frame

Message ID 20180417001346.8174-5-michael@niedermayer.cc
State Accepted
Commit 5549488bbf3a23c0fb9833cefc6354f97055dd96
Headers show

Commit Message

Michael Niedermayer April 17, 2018, 12:13 a.m. UTC
Fixes: Timeout
Fixes: 6306/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DSICINVIDEO_fuzzer-5079253549842432

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

Comments

Michael Niedermayer April 19, 2018, 8:18 p.m. UTC | #1
On Tue, Apr 17, 2018 at 02:13:46AM +0200, Michael Niedermayer wrote:
> Fixes: Timeout
> Fixes: 6306/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DSICINVIDEO_fuzzer-5079253549842432
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/dsicinvideo.c | 7 +++++++
>  1 file changed, 7 insertions(+)

will apply

[...]
diff mbox

Patch

diff --git a/libavcodec/dsicinvideo.c b/libavcodec/dsicinvideo.c
index add7afa383..aa080417d2 100644
--- a/libavcodec/dsicinvideo.c
+++ b/libavcodec/dsicinvideo.c
@@ -158,6 +158,9 @@  static int cin_decode_lzss(const unsigned char *src, int src_size,
         }
     }
 
+    if (dst_end - dst > dst_size - dst_size/10)
+        return AVERROR_INVALIDDATA;
+
     return 0;
 }
 
@@ -184,6 +187,10 @@  static int cin_decode_rle(const unsigned char *src, int src_size,
         }
         dst += len;
     }
+
+    if (dst_end - dst > dst_size - dst_size/10)
+        return AVERROR_INVALIDDATA;
+
     return 0;
 }