summaryrefslogtreecommitdiff
path: root/libavcodec/huffyuvdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-06-05 22:05:27 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2020-06-06 00:38:53 +0200
commita1223ddc5692772198a02600ecff2545f32b37be (patch)
treed61b659b72ee9b647cfde05048278f557fc7025b /libavcodec/huffyuvdec.c
parentd9aa1ef2c2dfbadcfe3783cee97e9c59dbfe7fb1 (diff)
avcodec/huffyuvdec: Test vertical coordinate more often
Fixes: out of array access Fixes: 22892/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HYMT_fuzzer-5135996772679680.fuzz Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/huffyuvdec.c')
-rw-r--r--libavcodec/huffyuvdec.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c
index 0ee7ec3917..e713b91e4d 100644
--- a/libavcodec/huffyuvdec.c
+++ b/libavcodec/huffyuvdec.c
@@ -928,12 +928,16 @@ static int decode_slice(AVCodecContext *avctx, AVFrame *p, int height,
left= left_prediction(s, p->data[plane], s->temp[0], w, 0);
y = 1;
+ if (y >= h)
+ break;
/* second line is left predicted for interlaced case */
if (s->interlaced) {
decode_plane_bitstream(s, w, plane);
left = left_prediction(s, p->data[plane] + p->linesize[plane], s->temp[0], w, left);
y++;
+ if (y >= h)
+ break;
}
lefttop = p->data[plane][0];
@@ -1045,6 +1049,8 @@ static int decode_slice(AVCodecContext *avctx, AVFrame *p, int height,
}
cy = y = 1;
+ if (y >= height)
+ break;
/* second line is left predicted for interlaced case */
if (s->interlaced) {
@@ -1057,6 +1063,8 @@ static int decode_slice(AVCodecContext *avctx, AVFrame *p, int height,
}
y++;
cy++;
+ if (y >= height)
+ break;
}
/* next 4 pixels are left predicted too */