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 A85AF4A462 for ; Thu, 30 May 2024 19:08:00 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 99E0E68D30D; Thu, 30 May 2024 22:07:21 +0300 (EEST) Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0922C68D265 for ; Thu, 30 May 2024 22:07:14 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 5FDA31C0003 for ; Thu, 30 May 2024 19:07:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1717096034; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=2RBegXLuJH7ek81AjHVCq4Zjh0jU4BrgpJdzdMzLCDc=; b=SsDx79jc8PFvZpKktLlORP0LjGQDmxsE47LDZGD2uj7c2Y39IfwrBkwxrGs+wLjiZp4buM RFg9vXooJujDr8uudFrjLDvx4aE9jscsaj9Ae3e0M+8MVQ91CtG9ko/r/lQyTIFuoCMm+H NxXzJuGeBiEaKz2zBgXhrkwWh9IDbjXXUPxyrroZxQZ6BfV2fYJ2x8vl7JWRUb2tc7FftV C47XcEVGkxWxSfFVp6ymtbO2Cn6Lq/4UJjVCMqhvc5oOo9504k4xB0HiEZlwjkr161+eqp ZmaBKvqQ1WdmdYiy1lNuI5aiDlR13XWUht0sYOcHfex9WILsHgnyU3hQcgZIbg== Date: Thu, 30 May 2024 21:07:13 +0200 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20240530190713.GB2821752@pb2> References: <27e5f614496e729f68326a31c3ac70d5923cfa97.camel@haerdin.se> <8012443e7bcefe0eea730fe694e38975a6a3d074.camel@haerdin.se> <3421890.a5N6fE6ukZ@basile.remlab.net> MIME-Version: 1.0 In-Reply-To: <3421890.a5N6fE6ukZ@basile.remlab.net> X-GND-Sasl: michael@niedermayer.cc Subject: Re: [FFmpeg-devel] [PATCH 1/5] lavu/common.h: Fix UB in av_clipl_int32_c() 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="===============1085749866570097755==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============1085749866570097755== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="l8YfOjwMha7d9KWK" Content-Disposition: inline --l8YfOjwMha7d9KWK Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, May 30, 2024 at 08:49:12PM +0300, R=E9mi Denis-Courmont wrote: > Le torstaina 30. toukokuuta 2024, 19.48.13 EEST Tomas H=E4rdin a =E9crit : > > > > Are you saying that UB is acceptable? You know the compiler is free > > > > to > > > > assume signed arithmetic doesn't overflow, right? If so then what > > > > other > > > > UB might we accept? > > >=20 > > > He did not say that... He said we should switch to a better > > > implementation rather than trying to fix the existing potentially > > > buggy one. > >=20 > > I have a fix for demonstrable UB and R=E9mi is problematizing it. >=20 > Andreas made cosmetic arguments against this patch before I had even seen= the=20 > patch, forget comment on it. >=20 > > It is not a "theoretical" UB - that's not how UB works. >=20 > It is a *theoretical* UB if you can not prove that it leads to misbehavio= ur in=20 If the function doesnt get called with values triggering UB then its not UB. If the function gets called with values triggering the signed overflow then= its UB And its a bug unless the applications intended behavior is undefined. also i would not bet on that the function produces the correct output for input values that trigger UB on every platform The case where this really could be a problem is if its used with compile time constants that would trigger the overflow because in these cases the optimizer can assume the whole codepath leading to it can be removed. IMHO we should simply fix UB instead of arguing over how bad it could be or when. thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Those who would give up essential Liberty, to purchase a little temporary Safety, deserve neither Liberty nor Safety -- Benjamin Franklin --l8YfOjwMha7d9KWK Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEKAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZljOWgAKCRBhHseHBAsP q1VGAJ4xt3TuKJ6gac/QpsCtmS0W2ZMnPQCeIXuKnWEY8qYX9ycxsCTbofMVDaM= =SZ3H -----END PGP SIGNATURE----- --l8YfOjwMha7d9KWK-- --===============1085749866570097755== 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". --===============1085749866570097755==--