diff mbox

[FFmpeg-devel,1/2] avcodec/msvideo1: Check for too small dimensions

Message ID 20181201211620.21921-1-michael@niedermayer.cc
State Accepted
Commit 953bd58861ad933e614510140b05a61e3d1375be
Headers show

Commit Message

Michael Niedermayer Dec. 1, 2018, 9:16 p.m. UTC
Such low resolution would result in empty output as a minimum of 4x4 is needed
We could also check for multiple of 4 dimensions but that is not needed

Fixes: Timeout
Fixes: 11191/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MSVIDEO1_fuzzer-5739529588178944

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

Comments

Michael Niedermayer Dec. 4, 2018, 11:39 p.m. UTC | #1
On Sat, Dec 01, 2018 at 10:16:19PM +0100, Michael Niedermayer wrote:
> Such low resolution would result in empty output as a minimum of 4x4 is needed
> We could also check for multiple of 4 dimensions but that is not needed
> 
> Fixes: Timeout
> Fixes: 11191/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MSVIDEO1_fuzzer-5739529588178944
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/msvideo1.c | 3 +++
>  1 file changed, 3 insertions(+)

will apply

[...]
diff mbox

Patch

diff --git a/libavcodec/msvideo1.c b/libavcodec/msvideo1.c
index 29700f54b6..de048d8b6f 100644
--- a/libavcodec/msvideo1.c
+++ b/libavcodec/msvideo1.c
@@ -62,6 +62,9 @@  static av_cold int msvideo1_decode_init(AVCodecContext *avctx)
 
     s->avctx = avctx;
 
+    if (avctx->width < 4 || avctx->height < 4)
+        return AVERROR_INVALIDDATA;
+
     /* figure out the colorspace based on the presence of a palette */
     if (s->avctx->bits_per_coded_sample == 8) {
         s->mode_8bit = 1;