Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:77602 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 11079 invoked from network); 25 Sep 2014 02:00:32 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Sep 2014 02:00:32 -0000 Authentication-Results: pb1.pair.com smtp.mail=ajf@ajf.me; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ajf@ajf.me; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ajf.me designates 192.64.116.208 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 192.64.116.208 imap2-3.ox.privateemail.com Received: from [192.64.116.208] ([192.64.116.208:53573] helo=imap2-3.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A9/80-06184-F3773245 for ; Wed, 24 Sep 2014 22:00:32 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id E24EE8C0080; Wed, 24 Sep 2014 22:00:27 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at imap2.ox.privateemail.com Received: from mail.privateemail.com ([127.0.0.1]) by localhost (imap2.ox.privateemail.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id HvbWkn4KWjkh; Wed, 24 Sep 2014 22:00:27 -0400 (EDT) Received: from [137.50.174.194] (oa-edu-174-194.wireless.abdn.ac.uk [137.50.174.194]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.privateemail.com (Postfix) with ESMTPSA id B57E48C007B; Wed, 24 Sep 2014 22:00:24 -0400 (EDT) References: <07153B91-E12F-4B16-ADD7-86CFC75C4642@ajf.me> <54220EB4.60001@sugarcrm.com> <6A21F4EF-476E-476C-A64B-246B8929172B@ajf.me> <5422DD87.80109@gmail.com> <568C0F03-B23B-43FC-963D-6D0D23405E9D@ajf.me> <54230209.2050406@sugarcrm.com> <54233C70.3060604@gmail.com> <54236D16.3070401@sugarcrm.com> Mime-Version: 1.0 (1.0) In-Reply-To: <54236D16.3070401@sugarcrm.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: Cc: Rowan Collins , "internals@lists.php.net" X-Mailer: iPhone Mail (12A365) Date: Thu, 25 Sep 2014 03:00:18 +0100 To: Stas Malyshev Subject: Re: [PHP-DEV] [RFC] ZPP Failure On Overflow From: ajf@ajf.me (Andrea Faulds) > On 25 Sep 2014, at 02:17, Stas Malyshev wrote: > > Hi! > >> So, the problem comes with built-in functions, which have some side >> effect, which can be usefully run with a bogus value for an integer >> argument. In contrast, any function which has some side effect which is >> actively harmful given a bogus value would be a beneficiary of the change. > > No bogus value ever gets to a function - it always gets INT_MAX on > overflow. If INT_MAX is harmful for this function, this change does not > help as you could still pass INT_MAX and this change would not do anything. > > The thing is relying on this would not really improve your code - it is > very rare that INT_MAX+1 is harmful for your function but INT_MAX-1 is > not. But it may be useful to know that you can pass any value and it > will be capped at INT_MAX. No it won't. Normally it truncates (module), only some functions cap. -- Andrea Faulds http://ajf.me/