diff mbox

[FFmpeg-devel] avcodec/qpeg: Optimize full width runs in qpeg_decode_intra()

Message ID 20181105221747.18379-1-michael@niedermayer.cc
State Accepted
Commit 07bc603757caa5d2054c56629bb93d7a177e8e88
Headers show

Commit Message

Michael Niedermayer Nov. 5, 2018, 10:17 p.m. UTC
This improves the speed of decoding large patches of constant color

Fixes: Timeout
Fixes: 10967/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_QPEG_fuzzer-5630803793936384

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/qpeg.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Michael Niedermayer Nov. 8, 2018, 9:40 p.m. UTC | #1
On Mon, Nov 05, 2018 at 11:17:47PM +0100, Michael Niedermayer wrote:
> This improves the speed of decoding large patches of constant color
> 
> Fixes: Timeout
> Fixes: 10967/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_QPEG_fuzzer-5630803793936384
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/qpeg.c | 6 ++++++
>  1 file changed, 6 insertions(+)

will apply


[...]
diff mbox

Patch

diff --git a/libavcodec/qpeg.c b/libavcodec/qpeg.c
index e1210c1972..cb452621e7 100644
--- a/libavcodec/qpeg.c
+++ b/libavcodec/qpeg.c
@@ -85,6 +85,12 @@  static void qpeg_decode_intra(QpegContext *qctx, uint8_t *dst,
                     filled = 0;
                     dst -= stride;
                     rows_to_go--;
+                    while (run - i > width && rows_to_go > 0) {
+                        memset(dst, p, width);
+                        dst -= stride;
+                        rows_to_go--;
+                        i += width;
+                    }
                     if(rows_to_go <= 0)
                         break;
                 }