Commit 038d291b authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/qpeg: Optimize long runs in qpeg_decode_intra() not spanning a full row

Fixes: Timeout
Fixes: 11354/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_QPEG_fuzzer-5766275943366656

Before: Executed clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_QPEG_fuzzer-5766275943366656 in 9470 ms
After : Executed clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_QPEG_fuzzer-5766275943366656 in  134 ms

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpegReviewed-by: 's avatarPaul B Mahol <onemda@gmail.com>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent e9564f7f
......@@ -80,7 +80,10 @@ static void qpeg_decode_intra(QpegContext *qctx, uint8_t *dst,
p = bytestream2_get_byte(&qctx->buffer);
for(i = 0; i < run; i++) {
dst[filled++] = p;
int step = FFMIN(run - i, width - filled);
memset(dst+filled, p, step);
filled += step;
i += step - 1;
if (filled >= width) {
filled = 0;
dst -= stride;
......
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