Commit e63517e0 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/rpza: Check that there is enough data for all the blocks

Fixes: Timeout
Fixes: 11547/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RPZA_fuzzer-5678435842654208

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpegSigned-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 8a708aa9
...@@ -105,6 +105,9 @@ static int rpza_decode_stream(RpzaContext *s) ...@@ -105,6 +105,9 @@ static int rpza_decode_stream(RpzaContext *s)
/* Number of 4x4 blocks in frame. */ /* Number of 4x4 blocks in frame. */
total_blocks = ((s->avctx->width + 3) / 4) * ((s->avctx->height + 3) / 4); total_blocks = ((s->avctx->width + 3) / 4) * ((s->avctx->height + 3) / 4);
if (total_blocks / 32 > bytestream2_get_bytes_left(&s->gb))
return AVERROR_INVALIDDATA;
if ((ret = ff_reget_buffer(s->avctx, s->frame)) < 0) if ((ret = ff_reget_buffer(s->avctx, s->frame)) < 0)
return ret; return ret;
pixels = (uint16_t *)s->frame->data[0]; pixels = (uint16_t *)s->frame->data[0];
......
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