From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 3AC9E4C012 for ; Tue, 5 Aug 2025 02:13:10 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 4202968C1FB; Tue, 5 Aug 2025 05:13:05 +0300 (EEST) Received: from mx.sdf.org (mx.sdf.org [205.166.94.24]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 825EE687C9E for ; Tue, 5 Aug 2025 05:12:58 +0300 (EEST) Received: from 436df3412bf9621d289a69bf8f875853 ([1.136.104.247]) (authenticated (0 bits)) by mx.sdf.org (8.18.1/8.14.3) with ESMTPSA id 5752Cnjt008049 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO) for ; Tue, 5 Aug 2025 02:12:54 GMT Date: Tue, 5 Aug 2025 12:12:47 +1000 From: Peter Ross To: FFmpeg development discussions and patches Message-ID: Mail-Followup-To: FFmpeg development discussions and patches References: <20250804225441.2028-1-jamrial@gmail.com> MIME-Version: 1.0 In-Reply-To: <20250804225441.2028-1-jamrial@gmail.com> Subject: Re: [FFmpeg-devel] [PATCH] avformat/iff: fix EOF check 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="===============6296985440160173129==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============6296985440160173129== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="0ZNxi6StaiWdUPvv" Content-Disposition: inline --0ZNxi6StaiWdUPvv Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Aug 04, 2025 at 07:54:41PM -0300, James Almer wrote: > The check to return on EOF should not be inside a block that will not be = entered after reaching EOF. > Should fix "libavcodec/bytestream.h:144:27: runtime error: applying zero = offset to null pointer". >=20 > Signed-off-by: James Almer > --- > libavformat/iff.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) >=20 > diff --git a/libavformat/iff.c b/libavformat/iff.c > index 4ff10beb38..44ba5a9023 100644 > --- a/libavformat/iff.c > +++ b/libavformat/iff.c > @@ -969,9 +969,6 @@ static int iff_read_packet(AVFormatContext *s, > uint32_t chunk_id, chunk_id2; > =20 > while (!avio_feof(pb)) { > - if (avio_feof(pb)) > - return AVERROR_EOF; > - > orig_pos =3D avio_tell(pb); > chunk_id =3D avio_rl32(pb); > data_size =3D avio_rb32(pb); > @@ -988,6 +985,9 @@ static int iff_read_packet(AVFormatContext *s, > avio_skip(pb, data_size); > } > } > + if (pb->eof_reached) > + return AVERROR_EOF; > + > ret =3D av_get_packet(pb, pkt, data_size); > pkt->stream_index =3D iff->video_stream_index; > pkt->pos =3D orig_pos; Please apply. If this doesn't fix the UBSAN runtime error, I propose to add a data_size sanity check immediately before av_get_packet: if (!data_size) return AVERROR_INVALIDDATA; It seems some IFF ANIM files have lots of zeros around EOF, including the file in fate samples. -- Peter (A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B) --0ZNxi6StaiWdUPvv Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQSpB+AvpuUM0jTNINJnYHnFrEDdawUCaJFomwAKCRBnYHnFrEDd a5OOAJ0RQdZSqoZaNV4A8BTx0c2C7c5NcQCglPNbY4QthkhXPizWHRAMkkA5wjE= =wu3W -----END PGP SIGNATURE----- --0ZNxi6StaiWdUPvv-- --===============6296985440160173129== 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". --===============6296985440160173129==--