summaryrefslogtreecommitdiff
path: root/libavcodec/nuv.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-11-02 14:14:44 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2019-11-25 00:07:07 +0100
commit1138cdecbe0164ab1f07768418e794fddfdc636d (patch)
treefd8e8c95f7fde6afa73d46d5e63e8019696095e7 /libavcodec/nuv.c
parentcf323f4d38f5756ecdb8fb4f72c80a8069da832e (diff)
avcodec/nuv: Move comptype check up
Fixes: Timeout (23sec -> 5ms) Fixes: 18517/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_NUV_fuzzer-5753135536013312 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/nuv.c')
-rw-r--r--libavcodec/nuv.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/libavcodec/nuv.c b/libavcodec/nuv.c
index bb80e3e884..eb82d375ea 100644
--- a/libavcodec/nuv.c
+++ b/libavcodec/nuv.c
@@ -219,6 +219,14 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
case NUV_RTJPEG:
minsize = c->width/16 * (c->height/16) * 6;
break;
+ case NUV_BLACK:
+ case NUV_COPY_LAST:
+ case NUV_LZO:
+ case NUV_RTJPEG_IN_LZO:
+ break;
+ default:
+ av_log(avctx, AV_LOG_ERROR, "unknown compression\n");
+ return AVERROR_INVALIDDATA;
}
if (buf_size < minsize / 4)
return AVERROR_INVALIDDATA;
@@ -307,9 +315,6 @@ retry:
case NUV_COPY_LAST:
/* nothing more to do here */
break;
- default:
- av_log(avctx, AV_LOG_ERROR, "unknown compression\n");
- return AVERROR_INVALIDDATA;
}
if ((result = av_frame_ref(picture, c->pic)) < 0)