diff mbox

[FFmpeg-devel,1/3] avcodec/ffv1dec_template: do not ignore the return code of decode_line()

Message ID 20180826235037.24153-1-michael@niedermayer.cc
State Accepted
Commit c5e574a0d0f9a849fdc9e6a779f733eddc048596
Headers show

Commit Message

Michael Niedermayer Aug. 26, 2018, 11:50 p.m. UTC
Fixes: Timeout
Fixes: 9710/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFV1_fuzzer-4918894635515904

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 | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

Comments

Michael Niedermayer Sept. 2, 2018, 9:39 p.m. UTC | #1
On Mon, Aug 27, 2018 at 01:50:35AM +0200, Michael Niedermayer wrote:
> Fixes: Timeout
> Fixes: 9710/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFV1_fuzzer-4918894635515904
> 
> 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 | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)

will apply patchset

[...]
diff mbox

Patch

diff --git a/libavcodec/ffv1dec_template.c b/libavcodec/ffv1dec_template.c
index f8a42a6d44..fecdbd0025 100644
--- a/libavcodec/ffv1dec_template.c
+++ b/libavcodec/ffv1dec_template.c
@@ -107,7 +107,7 @@  static av_always_inline int RENAME(decode_line)(FFV1Context *s, int w,
     return 0;
 }
 
-static void RENAME(decode_rgb_frame)(FFV1Context *s, uint8_t *src[4], int w, int h, int stride[4])
+static int RENAME(decode_rgb_frame)(FFV1Context *s, uint8_t *src[4], int w, int h, int stride[4])
 {
     int x, y, p;
     TYPE *sample[4][2];
@@ -127,6 +127,7 @@  static void RENAME(decode_rgb_frame)(FFV1Context *s, uint8_t *src[4], int w, int
 
     for (y = 0; y < h; y++) {
         for (p = 0; p < 3 + transparency; p++) {
+            int ret;
             TYPE *temp = sample[p][0]; // FIXME: try a normal buffer
 
             sample[p][0] = sample[p][1];
@@ -135,9 +136,11 @@  static void RENAME(decode_rgb_frame)(FFV1Context *s, uint8_t *src[4], int w, int
             sample[p][1][-1]= sample[p][0][0  ];
             sample[p][0][ w]= sample[p][0][w-1];
             if (lbd && s->slice_coding_mode == 0)
-                RENAME(decode_line)(s, w, sample[p], (p + 1)/2, 9);
+                ret = RENAME(decode_line)(s, w, sample[p], (p + 1)/2, 9);
             else
-                RENAME(decode_line)(s, w, sample[p], (p + 1)/2, bits + (s->slice_coding_mode != 1));
+                ret = RENAME(decode_line)(s, w, sample[p], (p + 1)/2, bits + (s->slice_coding_mode != 1));
+            if (ret < 0)
+                return ret;
         }
         for (x = 0; x < w; x++) {
             int g = sample[0][1][x];
@@ -168,4 +171,5 @@  static void RENAME(decode_rgb_frame)(FFV1Context *s, uint8_t *src[4], int w, int
             }
         }
     }
+    return 0;
 }