Gmane
Picon Picon Favicon
From: Steve Lime <steve.lime <at> DNR.STATE.MN.US>
Subject: [UMN_MAPSERVER-USERS] Important! 1 pixel anti-aliasing seg. faults...
Newsgroups: gmane.comp.gis.mapserver.user
Date: 2006-02-14 17:35:43 GMT (2 years, 13 weeks, 19 hours and 15 minutes ago)
Hi all: There have been a number of users reporting issues with 1 pixel wide antialiasing
seg. faults and version 4.8.  There is a problem with GD.  The library does not properly
check pixel values against the image size which can result in a buffer overflow in some
cases. The GD author is aware of the problem but has not released a fix yet- no idea
why since it is a pretty severe error.

Anyway, to use 1 pixel-wide antialiasing you *MUST* apply a small fix to GD. Fortunately 
the fix is a one-liner. 

In gd.c,  function gdImageSetAAPixelColor() change:

int dr,dg,db,p,r,g,b;

p = gdImageGetPixel(im,x,y);

to:

int dr,dg,db,p,r,g,b;

if (!gdImageBoundsSafeMacro (im, x, y)) return;

p = gdImageGetPixel(im,x,y);

I can put together a patch version of the gd-2.033 source if folks are interested.

Steve