[FFmpeg-cvslog] avcodec/huffyuvdec: Check that slices do not exceed frame height

Michael Niedermayer git at videolan.org
Sun Jan 6 20:34:41 EET 2019


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Sun Jan  6 12:17:06 2019 +0100| [ab160efa2850715de32e24fed846a0f6ef7244ab] | committer: Michael Niedermayer

avcodec/huffyuvdec: Check that slices do not exceed frame height

Fixes: Out of array access
Fixes: 12367/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HYMT_fuzzer-5662313959391232
Fixes: 12370/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HYMT_fuzzer-5670984961490944
Fixes: 12376/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HYMT_fuzzer-5644026183680000
Fixes: 12383/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HYMT_fuzzer-5722087214284800
Fixes: 12390/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HYMT_fuzzer-5696653095337984
Fixes: 12408/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HYMT_fuzzer-5729689379799040

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>

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

 libavcodec/huffyuvdec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c
index dfe3585e6e..8226c07743 100644
--- a/libavcodec/huffyuvdec.c
+++ b/libavcodec/huffyuvdec.c
@@ -1254,7 +1254,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
         slices_info_offset = AV_RL32(avpkt->data + buf_size - 4);
         slice_height = AV_RL32(avpkt->data + buf_size - 8);
         nb_slices = AV_RL32(avpkt->data + buf_size - 12);
-        if (nb_slices * 8LL + slices_info_offset > buf_size - 16 || slice_height <= 0)
+        if (nb_slices * 8LL + slices_info_offset > buf_size - 16 ||
+            slice_height <= 0 || nb_slices * (uint64_t)slice_height > height)
             return AVERROR_INVALIDDATA;
     } else {
         slice_height = height;



More information about the ffmpeg-cvslog mailing list