[FFmpeg-devel] [PATCH 1/2] avcodec/pictordec: Check that the image fits in the input

Peter Ross pross at xvid.org
Fri Nov 25 08:45:29 EET 2022


On Tue, Nov 22, 2022 at 11:56:51PM +0100, Michael Niedermayer wrote:
> Fixes: Timeout
> Fixes: 53438/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PICTOR_fuzzer-5458939919859712
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpe
> Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> ---
>  libavcodec/pictordec.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/libavcodec/pictordec.c b/libavcodec/pictordec.c
> index 71bad40a0a..09229b94fd 100644
> --- a/libavcodec/pictordec.c
> +++ b/libavcodec/pictordec.c
> @@ -162,6 +162,9 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
>  
>      if (av_image_check_size(s->width, s->height, 0, avctx) < 0)
>          return -1;
> +    if (bytestream2_get_bytes_left(&s->g) < s->width * s->height / 65536 * 5)
> +        return AVERROR_INVALIDDATA;

how did you arrive at this formula?

-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20221125/9e120ff9/attachment.sig>


More information about the ffmpeg-devel mailing list