Commit c5e574a0 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/ffv1dec_template: do not ignore the return code of decode_line()

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/ffmpegSigned-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 0c88a5d3
...@@ -107,7 +107,7 @@ static av_always_inline int RENAME(decode_line)(FFV1Context *s, int w, ...@@ -107,7 +107,7 @@ static av_always_inline int RENAME(decode_line)(FFV1Context *s, int w,
return 0; 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; int x, y, p;
TYPE *sample[4][2]; TYPE *sample[4][2];
...@@ -127,6 +127,7 @@ static void RENAME(decode_rgb_frame)(FFV1Context *s, uint8_t *src[4], int w, int ...@@ -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 (y = 0; y < h; y++) {
for (p = 0; p < 3 + transparency; p++) { for (p = 0; p < 3 + transparency; p++) {
int ret;
TYPE *temp = sample[p][0]; // FIXME: try a normal buffer TYPE *temp = sample[p][0]; // FIXME: try a normal buffer
sample[p][0] = sample[p][1]; 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 ...@@ -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][1][-1]= sample[p][0][0 ];
sample[p][0][ w]= sample[p][0][w-1]; sample[p][0][ w]= sample[p][0][w-1];
if (lbd && s->slice_coding_mode == 0) 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 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++) { for (x = 0; x < w; x++) {
int g = sample[0][1][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 ...@@ -168,4 +171,5 @@ static void RENAME(decode_rgb_frame)(FFV1Context *s, uint8_t *src[4], int w, int
} }
} }
} }
return 0;
} }
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