Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:43290 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 51766 invoked from network); 10 Mar 2009 11:19:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Mar 2009 11:19:48 -0000 Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.158 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 209.85.220.158 mail-fx0-f158.google.com Received: from [209.85.220.158] ([209.85.220.158:46546] helo=mail-fx0-f158.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 95/4B-30036-2DC46B94 for ; Tue, 10 Mar 2009 06:19:47 -0500 Received: by fxm2 with SMTP id 2so1575324fxm.23 for ; Tue, 10 Mar 2009 04:19:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=hc6Vjlno/90bPwXmXIhvxICPWeV5rk4s14fLKlyXzFA=; b=EOnC10nMqSoMn0qVv1av6yMntZsoLexHJaypH41JJvSEXmbFE/Prl8ZgY3qkTQ0cHz 2jUjbibj6fSO4WqwKnIt6HmBojr9l34j5HVx3Yrs4v2vnsM3bG791M/46MD+q7JmVvjJ bKO+gMkTebeKpAAXOIICYVNfLngUaV7pNFXqw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=r4bOy1HsiXUee/zhjcMjF/qci3bEZUfjyprmBF0/8bmngbBE0JvDIPMr6rTYRf+p1O rnR1jxrD+JSw32L2MCmac/2tsNuoOl8wQYjNatEBYKo8GZ1lrkj3caUEY3dEV4AcRoEC 3s3HCezuqdEAZjQOixHOzXfasSsqgYX9pgvVE= MIME-Version: 1.0 Received: by 10.86.53.11 with SMTP id b11mr4854674fga.23.1236683982722; Tue, 10 Mar 2009 04:19:42 -0700 (PDT) In-Reply-To: <1236683833.23999.18.camel@vimes> References: <1236683833.23999.18.camel@vimes> Date: Tue, 10 Mar 2009 12:19:42 +0100 Message-ID: To: Martin McNickle Cc: internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [PATCH] Bug #45799 - imagepng() crashes on empty image From: pierre.php@gmail.com (Pierre Joye) hi, Please post a link to the patch in the bug tracker directly. Thanks for your work, Cheers, On Tue, Mar 10, 2009 at 12:17 PM, Martin McNickle wrote: > Hi all, > > I've created a simple patch for Bug #45799 [1] > > It employs a simple check to see if there are any colors associated with > the image before outputting the PNG header. > > The patch is against CVS 5.3, shown below for convenience. I can create > patches for the other branches if required. The tests pass. > > This is my first patch to PHP, so I've done anything wrong, give me some > pointers as to how to fix it. > > Thanks, > > -- Martin McNickle > > [1] http://bugs.php.net/bug.php?id=3D45799 > > Index: ext/gd/libgd/gd_png.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > RCS file: /repository/php-src/ext/gd/libgd/gd_png.c,v > retrieving revision 1.17.4.2.2.5.2.3 > diff -u -r1.17.4.2.2.5.2.3 gd_png.c > --- ext/gd/libgd/gd_png.c =A0 =A0 =A0 14 Jan 2009 10:16:15 -0000 =A0 =A0 = =A01.17.4.2.2.5.2.3 > +++ ext/gd/libgd/gd_png.c =A0 =A0 =A0 10 Mar 2009 11:12:02 -0000 > @@ -650,6 +650,12 @@ > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0png_set_PLTE(png_ptr, info_ptr, palette, c= olors); > =A0 =A0 =A0 =A0} > > + =A0 =A0 =A0 if (colors <=3D 0 && !im->trueColor) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 php_gd_error("gd-png error: Invalid number = of colors in > palette./martin"); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 png_destroy_write_struct (&png_ptr, &info_p= tr); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return; > + =A0 =A0 =A0 } > + > =A0 =A0 =A0 =A0/* write out the PNG header info (everything up to first I= DAT) */ > =A0 =A0 =A0 =A0png_write_info(png_ptr, info_ptr); > > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > --=20 Pierre http://blog.thepimp.net | http://www.libgd.org