From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id DE8A0472B9 for ; Fri, 3 Nov 2023 20:49:24 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3814968CDAD; Fri, 3 Nov 2023 22:49:22 +0200 (EET) Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A293D68CD86 for ; Fri, 3 Nov 2023 22:49:14 +0200 (EET) Received: by mail.gandi.net (Postfix) with ESMTPSA id 01828FF80D for ; Fri, 3 Nov 2023 20:49:13 +0000 (UTC) Date: Fri, 3 Nov 2023 21:49:13 +0100 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20231103204913.GE3543730@pb2> References: <20231102235016.3935-1-michael@niedermayer.cc> <20231102235016.3935-3-michael@niedermayer.cc> MIME-Version: 1.0 In-Reply-To: X-GND-Sasl: michael@niedermayer.cc Subject: Re: [FFmpeg-devel] [PATCH 3/4] avcodec/flicvideo: consider width in copy loops X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: multipart/mixed; boundary="===============5324793516790368860==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============5324793516790368860== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="41LFzYP+9Awq5Uoy" Content-Disposition: inline --41LFzYP+9Awq5Uoy Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Nov 02, 2023 at 08:08:41PM -0400, Sean McGovern wrote: > On Thu, Nov 2, 2023, 19:50 Michael Niedermayer > wrote: >=20 > > Fixes: out of array write > > Fixes: > > 63520/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FLIC_fuzzer-487= 6198087622656 > > Regression since: c7f8d42c12582b0626ea38117df6c9aea9fcf5b1 (was not pos= ted > > to ffmpeg-devel) > > > > Found-by: continuous fuzzing process > > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > > Signed-off-by > > : > > Michael Niedermayer > > --- > > libavcodec/flicvideo.c | 6 +++--- > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > diff --git a/libavcodec/flicvideo.c b/libavcodec/flicvideo.c > > index 6ce033ba409..43f3f83bf65 100644 > > --- a/libavcodec/flicvideo.c > > +++ b/libavcodec/flicvideo.c > > @@ -642,7 +642,7 @@ static int flic_decode_frame_8BPP(AVCodecContext > > *avctx, > > "has incorrect size, skipping chunk\n", chunk_s= ize > > - 6); > > bytestream2_skip(&g2, chunk_size - 6); > > } else { > > - for (y_ptr =3D 0; check_pixel_ptr(y_ptr, 0, pixel_limi= t, > > direction) =3D=3D 0; > > + for (y_ptr =3D 0; check_pixel_ptr(y_ptr, s->avctx->wid= th, > > pixel_limit, direction) =3D=3D 0; > > y_ptr +=3D s->frame->linesize[0]) { > > bytestream2_get_buffer(&g2, &pixels[y_ptr], > > s->avctx->width); > > @@ -949,7 +949,7 @@ static int flic_decode_frame_15_16BPP(AVCodecContext > > *avctx, > > > > if (bytestream2_get_bytes_left(&g2) < 2 * s->avctx->wi= dth > > * s->avctx->height ) > > return AVERROR_INVALIDDATA; > > - for (y_ptr =3D 0; check_pixel_ptr(y_ptr, 0, pixel_limi= t, > > direction) =3D=3D 0; > > + for (y_ptr =3D 0; check_pixel_ptr(y_ptr, 2*s->avctx->w= idth, > > pixel_limit, direction) =3D=3D 0; > > y_ptr +=3D s->frame->linesize[0]) { > > > > pixel_countdown =3D s->avctx->width; > > @@ -1235,7 +1235,7 @@ static int flic_decode_frame_24BPP(AVCodecContext > > *avctx, > > "bigger than image, skipping chunk\n", chunk_si= ze > > - 6); > > bytestream2_skip(&g2, chunk_size - 6); > > } else { > > - for (y_ptr =3D 0; check_pixel_ptr(y_ptr, 0, pixel_limi= t, > > direction) =3D=3D 0; > > + for (y_ptr =3D 0; check_pixel_ptr(y_ptr, 3*s->avctx->w= idth, > > pixel_limit, direction) =3D=3D 0; > > y_ptr +=3D s->frame->linesize[0]) { > > > > bytestream2_get_buffer(&g2, pixels + y_ptr, > > 3*s->avctx->width); > > -- > > 2.17.1 > > > > _______________________________________________ > > 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". > > >=20 > On quick inspection this looks OK, will apply patchset (the first 2 with less funny commit messages) >but is s->avctx->width guaranteed to be > non-zero as well? if width somehow manages to be 0 then reget_buffer would fail so none of this code should be reachable thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The smallest minority on earth is the individual. Those who deny=20 individual rights cannot claim to be defenders of minorities. - Ayn Rand --41LFzYP+9Awq5Uoy Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEIAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZUVcwgAKCRBhHseHBAsP qzGAAJkBfU5DQW51LIXMxPdqFcqw5OF6YgCcCaRB6EdEgaXSgV9ZF2T22Ncdvdg= =1k2t -----END PGP SIGNATURE----- --41LFzYP+9Awq5Uoy-- --===============5324793516790368860== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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". --===============5324793516790368860==--