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/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit e63517e00a1a8375c7fb3b8c4c64c9a7c3da713e)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
... | ... |
@@ -105,6 +105,9 @@ static int rpza_decode_stream(RpzaContext *s) |
105 | 105 |
/* Number of 4x4 blocks in frame. */ |
106 | 106 |
total_blocks = ((s->avctx->width + 3) / 4) * ((s->avctx->height + 3) / 4); |
107 | 107 |
|
108 |
+ if (total_blocks / 32 > bytestream2_get_bytes_left(&s->gb)) |
|
109 |
+ return AVERROR_INVALIDDATA; |
|
110 |
+ |
|
108 | 111 |
if ((ret = ff_reget_buffer(s->avctx, s->frame)) < 0) |
109 | 112 |
return ret; |
110 | 113 |
pixels = (uint16_t *)s->frame->data[0]; |