diff mbox

[FFmpeg-devel,2/2] avcodec/huffyuvdec: Check vertical subsampling in hymt

Message ID 20190703223755.6319-2-michael@niedermayer.cc
State Accepted
Commit 9ffa32b81bede1dbb167dfceb48fe605b27a0890
Headers show

Commit Message

Michael Niedermayer July 3, 2019, 10:37 p.m. UTC
Fixes: out of array access
Fixes: 15484/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HYMT_fuzzer-5765377054736384
Fixes: 15559/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HYMT_fuzzer-5710295743332352

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/huffyuvdec.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Paul B Mahol July 12, 2019, 8:35 a.m. UTC | #1
LGTM

On 7/4/19, Michael Niedermayer <michael@niedermayer.cc> wrote:
> Fixes: out of array access
> Fixes:
> 15484/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HYMT_fuzzer-5765377054736384
> Fixes:
> 15559/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HYMT_fuzzer-5710295743332352
>
> Found-by: continuous fuzzing process
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/huffyuvdec.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c
> index 771481fd03..46dcfa8235 100644
> --- a/libavcodec/huffyuvdec.c
> +++ b/libavcodec/huffyuvdec.c
> @@ -1252,6 +1252,7 @@ static int decode_frame(AVCodecContext *avctx, void
> *data, int *got_frame,
>          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 ||
> +            s->chroma_v_shift ||
>              slice_height <= 0 || nb_slices * (uint64_t)slice_height >
> height)
>              return AVERROR_INVALIDDATA;
>      } else {
> --
> 2.22.0
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Michael Niedermayer July 12, 2019, 6:43 p.m. UTC | #2
On Fri, Jul 12, 2019 at 10:35:41AM +0200, Paul B Mahol wrote:
> LGTM

will apply

thanks

[...]
diff mbox

Patch

diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c
index 771481fd03..46dcfa8235 100644
--- a/libavcodec/huffyuvdec.c
+++ b/libavcodec/huffyuvdec.c
@@ -1252,6 +1252,7 @@  static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
         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 ||
+            s->chroma_v_shift ||
             slice_height <= 0 || nb_slices * (uint64_t)slice_height > height)
             return AVERROR_INVALIDDATA;
     } else {