[FFmpeg-cvslog] avcodec/huffyuvdec: Test vertical coordinate more often

Michael Niedermayer git at videolan.org
Tue Jul 7 21:40:28 EEST 2020


ffmpeg | branch: release/4.2 | Michael Niedermayer <michael at niedermayer.cc> | Fri Jun  5 22:05:27 2020 +0200| [ab4798ae39ab281f40a897da3fd0bb0c3d98985e] | committer: Michael Niedermayer

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 at gmail.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit a1223ddc5692772198a02600ecff2545f32b37be)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ab4798ae39ab281f40a897da3fd0bb0c3d98985e
---

 libavcodec/huffyuvdec.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c
index 46dcfa8235..d9bc032c3c 100644
--- a/libavcodec/huffyuvdec.c
+++ b/libavcodec/huffyuvdec.c
@@ -957,12 +957,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];
@@ -1074,6 +1078,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) {
@@ -1086,6 +1092,8 @@ static int decode_slice(AVCodecContext *avctx, AVFrame *p, int height,
                     }
                     y++;
                     cy++;
+                    if (y >= height)
+                        break;
                 }
 
                 /* next 4 pixels are left predicted too */



More information about the ffmpeg-cvslog mailing list