Commit 96e49508 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/huffyuvdec: Check that slice height is non negative.

Fixes: out of array access
Fixes: 12381/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HYMT_fuzzer-5705474280783872
Fixes: 12384/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HYMT_fuzzer-5725303345774592
Fixes: 12389/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HYMT_fuzzer-5704033050820608
Fixes: 12391/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HYMT_fuzzer-5707284146028544

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpegReviewed-by: 's avatarPaul B Mahol <onemda@gmail.com>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 4ec2daf0
...@@ -1254,7 +1254,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, ...@@ -1254,7 +1254,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
slices_info_offset = AV_RL32(avpkt->data + buf_size - 4); slices_info_offset = AV_RL32(avpkt->data + buf_size - 4);
slice_height = AV_RL32(avpkt->data + buf_size - 8); slice_height = AV_RL32(avpkt->data + buf_size - 8);
nb_slices = AV_RL32(avpkt->data + buf_size - 12); nb_slices = AV_RL32(avpkt->data + buf_size - 12);
if (nb_slices * 8LL + slices_info_offset > buf_size - 16) if (nb_slices * 8LL + slices_info_offset > buf_size - 16 || slice_height <= 0)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} else { } else {
slice_height = height; slice_height = height;
......
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