On Tue, Apr 06, 2021 at 11:50:22PM +0200, Michael Niedermayer wrote:
> Fixes: out of array read
> Fixes: 
> 32968/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MSP2_fuzzer-5315296027082752
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc>
> ---
>  libavcodec/msp2dec.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/msp2dec.c b/libavcodec/msp2dec.c
> index cc548d218a..87057fb5e2 100644
> --- a/libavcodec/msp2dec.c
> +++ b/libavcodec/msp2dec.c
> @@ -68,9 +68,10 @@ static int msp2_decode_frame(AVCodecContext *avctx,
>  
>          bytestream2_init(&gb, buf, pkt_size);
>          x = 0;
> -        while (bytestream2_get_bytes_left(&gb) && x < width) {
> +        while (bytestream2_get_bytes_left(&gb) > 0 && x < width) {
>              int size = bytestream2_get_byte(&gb);
>              if (size) {
> +                size = FFMIN(size, bytestream2_get_bytes_left(&gb));
>                  memcpy(p->data[0] + y * p->linesize[0] + x, gb.buffer, 
> FFMIN(size, width - x));
>                  bytestream2_skip(&gb, size);
>              } else {

please apply

-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)

Attachment: signature.asc
Description: PGP signature

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to