diff mbox

[FFmpeg-devel,1/2] avcodec/nuv: rtjpeg with dimensions less than 16 would result in no decoded pixels thus reject it

Message ID 20180227155324.3220-1-michael@niedermayer.cc
State Accepted
Commit 939440ad1aa820bed51f54d273b4fa6c5016d9f9
Headers show

Commit Message

Michael Niedermayer Feb. 27, 2018, 3:53 p.m. UTC
Fixes: Timeout
Fixes: 6297/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_NUV_fuzzer-4882404863901696

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

Comments

Michael Niedermayer March 12, 2018, 12:34 a.m. UTC | #1
On Tue, Feb 27, 2018 at 04:53:23PM +0100, Michael Niedermayer wrote:
> Fixes: Timeout
> Fixes: 6297/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_NUV_fuzzer-4882404863901696
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/nuv.c | 3 +++
>  1 file changed, 3 insertions(+)

will apply


[...]
diff mbox

Patch

diff --git a/libavcodec/nuv.c b/libavcodec/nuv.c
index ad6c029e50..15165ae3f5 100644
--- a/libavcodec/nuv.c
+++ b/libavcodec/nuv.c
@@ -198,6 +198,9 @@  static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
     case NUV_RTJPEG_IN_LZO:
     case NUV_RTJPEG:
         keyframe = !buf[2];
+        if (c->width < 16 || c->height < 16) {
+            return AVERROR_INVALIDDATA;
+        }
         break;
     case NUV_COPY_LAST:
         keyframe = 0;