Commit 3c0bfa7d authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/cpia: Check input size also against linesizes and EOL

Fixes: Timeout (14sec -> 29ms)
Fixes: 14733/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CPIA_fuzzer-5707022445576192

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpegReviewed-by: 's avatarCarl Eugen Hoyos <ceffmpeg@gmail.com>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent fbdb3aa1
...@@ -63,7 +63,7 @@ static int cpia_decode_frame(AVCodecContext *avctx, ...@@ -63,7 +63,7 @@ static int cpia_decode_frame(AVCodecContext *avctx,
uint8_t *y, *u, *v, *y_end, *u_end, *v_end; uint8_t *y, *u, *v, *y_end, *u_end, *v_end;
// Check header // Check header
if ( avpkt->size < FRAME_HEADER_SIZE if ( avpkt->size < FRAME_HEADER_SIZE + avctx->height * 3
|| header[0] != MAGIC_0 || header[1] != MAGIC_1 || header[0] != MAGIC_0 || header[1] != MAGIC_1
|| (header[17] != SUBSAMPLE_420 && header[17] != SUBSAMPLE_422) || (header[17] != SUBSAMPLE_420 && header[17] != SUBSAMPLE_422)
|| (header[18] != YUVORDER_YUYV && header[18] != YUVORDER_UYVY) || (header[18] != YUVORDER_YUYV && header[18] != YUVORDER_UYVY)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment