Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:15342 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 81636 invoked by uid 1010); 10 Mar 2005 10:44:00 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 81618 invoked from network); 10 Mar 2005 10:43:59 -0000 Received: from unknown (HELO yahoo.com) (127.0.0.1) by localhost with SMTP; 10 Mar 2005 10:43:59 -0000 X-Host-Fingerprint: 66.187.233.31 mx1.redhat.com Linux 2.4/2.6 Received: from ([66.187.233.31:50580] helo=mx1.redhat.com) by pb1.pair.com (ecelerity HEAD r(5124)) with SMTP id EA/7F-53294-FE420324 for ; Thu, 10 Mar 2005 05:43:59 -0500 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11/8.12.11) with ESMTP id j2AAhvG3027245 for ; Thu, 10 Mar 2005 05:43:57 -0500 Received: from radish.cambridge.redhat.com (radish.cambridge.redhat.com [172.16.18.90]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id j2AAhun22610 for ; Thu, 10 Mar 2005 05:43:56 -0500 Received: from radish.cambridge.redhat.com (localhost.localdomain [127.0.0.1]) by radish.cambridge.redhat.com (8.13.1/8.12.7) with ESMTP id j2AAhtgW007700 for ; Thu, 10 Mar 2005 10:43:55 GMT Received: (from jorton@localhost) by radish.cambridge.redhat.com (8.13.1/8.12.10/Submit) id j2AAhtj3007699 for internals@lists.php.net; Thu, 10 Mar 2005 10:43:55 GMT Date: Thu, 10 Mar 2005 10:43:55 +0000 To: internals@lists.php.net Message-ID: <20050310104355.GA7556@redhat.com> Mail-Followup-To: internals@lists.php.net References: <20050310101712.GA6960@redhat.com> <20050310102353.63103.qmail@lists.php.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20050310102353.63103.qmail@lists.php.net> User-Agent: Mutt/1.4.1i Subject: Re: [PHP-DEV] Re: [PATCH] exif warning fix? From: jorton@redhat.com (Joe Orton) On Thu, Mar 10, 2005 at 11:23:51AM +0100, Ard Biesheuvel wrote: > Joe Orton wrote: > >Testing "length >= LONG_MAX" where length is an int is always false, and > >gcc gives a warning for it. Perhaps something like this was intended? > > > > On 64-bit it is always false, however on 32-bit 'length == LONG_MAX' can > be true. That's probably why noone caught the warning so far, as gcc > would not emit it on a 32-bit system. > > If you're testing for overflow, casting to unsigned int won't help you > here, as the overflow will already have occurred when length was > assigned its value. Yes, sorry, I haven't turned my brain on yet this morning. So perhaps a test for (length < 0) is all that's really needed; I can't see why length == INT_MAX is particularly a special case here... joe