Skip to content

Commit

Permalink
avcodec/kgv1dec: Check that there is enough input for maximum RLE com…
Browse files Browse the repository at this point in the history
…pression

Fixes: Timeout
Fixes: 4271/clusterfuzz-testcase-4676667768307712

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <[email protected]>
  • Loading branch information
michaelni committed Nov 27, 2017
1 parent 38f966b commit 3aad94b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions libavcodec/kgv1dec.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
h = (buf[1] + 1) * 8;
buf += 2;

if (avpkt->size < 2 + w*h / 513)
return AVERROR_INVALIDDATA;

if (w != avctx->width || h != avctx->height) {
av_freep(&c->frame_buffer);
av_freep(&c->last_frame_buffer);
Expand Down

0 comments on commit 3aad94b

Please sign in to comment.