Re: [PATCH] Bug #45799 - imagepng() crashes on empty image
| From: | Martin McNickle | Date: | Tue, 10 Mar 2009 11:27:38 +0000 |
| Subject: | Re: [PATCH] Bug #45799 - imagepng() crashes on empty image | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-43291@lists.php.net to get a copy of this message | ||
Patch is in the tracker now.
-- Martin
On Tue, 2009-03-10 at 12:19 +0100, Pierre Joye wrote:
> 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
> <mmcnicklebugs@googlemail.com> 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=45799
> >
> > Index: ext/gd/libgd/gd_png.c
> > ===================================================================
> > 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 14 Jan 2009 10:16:15 -0000 1.17.4.2.2.5.2.3
> > +++ ext/gd/libgd/gd_png.c 10 Mar 2009 11:12:02 -0000
> > @@ -650,6 +650,12 @@
> > png_set_PLTE(png_ptr, info_ptr, palette, colors);
> > }
> >
> > + if (colors <= 0 && !im->trueColor) {
> > + php_gd_error("gd-png error: Invalid number of colors in
> > palette./martin");
> > + png_destroy_write_struct (&png_ptr, &info_ptr);
> > + return;
> > + }
> > +
> > /* write out the PNG header info (everything up to first IDAT) */
> > png_write_info(png_ptr, info_ptr);
> >
> >
> >
> > --
> > PHP Internals - PHP Runtime Development Mailing List
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>
>