[FFmpeg-devel] avcodec/ffv1dec_template: Check for the end of input after 1024 pixels

Submitted by Michael Niedermayer on Oct. 9, 2018, 3:14 a.m.

Details

Message ID 20181009031422.24611-1-michael@niedermayer.cc
State Accepted
Commit ccd2b20ad96c9d26ed27b4dabc08ea937987963e
Headers show

Commit Message

Michael Niedermayer Oct. 9, 2018, 3:14 a.m.
Fixes: Timeout
Fixes: 10385/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFV1_fuzzer-5689206987292672

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

Comments

Michael Niedermayer Oct. 11, 2018, 10:49 p.m.
On Tue, Oct 09, 2018 at 05:14:22AM +0200, Michael Niedermayer wrote:
> Fixes: Timeout
> Fixes: 10385/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFV1_fuzzer-5689206987292672
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/ffv1dec_template.c | 5 +++++
>  1 file changed, 5 insertions(+)

will apply

[...]

Patch hide | download patch | download mbox

diff --git a/libavcodec/ffv1dec_template.c b/libavcodec/ffv1dec_template.c
index fecdbd0025..25032feda0 100644
--- a/libavcodec/ffv1dec_template.c
+++ b/libavcodec/ffv1dec_template.c
@@ -50,6 +50,11 @@  static av_always_inline int RENAME(decode_line)(FFV1Context *s, int w,
     for (x = 0; x < w; x++) {
         int diff, context, sign;
 
+        if (!(x & 1023)) {
+            if (is_input_end(s))
+                return AVERROR_INVALIDDATA;
+        }
+
         context = RENAME(get_context)(p, sample[1] + x, sample[0] + x, sample[1] + x);
         if (context < 0) {
             context = -context;