[ka-Map-users] Segmentation fault in tile.php

David Badke dbadke at uvic.ca
Wed Mar 1 14:14:29 EST 2006


Jon:

The only thing I've seen was from the MapServer list (see below). The 
systems guys here applied the patch, but it didn't help. I have since 
run a test generating TrueType text using only GD/FreeType, which 
worked, and ka-Map tile.php with TYPE BITMAP in my .map file, which 
worked. Setting TYPE TRUETYPE causes the segmentation fault, and no one 
knows why... We are assuming it is some problem -- possibly 
configuration -- with PHP MapScript --> GD --> FreeType; it doesn't look 
like a problem in tile.php itself. MapScript is not generating any 
error, just crashing, so it is proving hard to track down.

Since no one else has reported a similar problem here, I guess no one 
else has seen this error... :'(

David


 >From the MapServer mailing list (14 Feb 2006): 
--------------------------------------------

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);

-----------------------------------------------------------------------------------------

Jon Fatula wrote:
> Hi, David,
>   No insights, just commiseration: after struggling mightily with 4.8/gd
> under RedHat ES3, I gave up and dropped back to 4.6.2... Have you seen
> any off-list patches or suggestions?
>
> Thanks!
> -jon
>
> Jon Fatula
> jonf at cruzio.com
>
> -----Original Message-----
> From: ka-map-users-bounces at lists.maptools.org
> [mailto:ka-map-users-bounces at lists.maptools.org]On Behalf Of David Badke
> Sent: Monday, February 27, 2006 11:29 AM
> To: ka-map-users at lists.maptools.org
> Subject: [ka-Map-users] Segmentation fault in tile.php
>
>
> I am running ka-Map on a local Windows XP system, and now on a remote 
> Linux server. Both systems are running the same ka-Map code (version 0.2 
> with mods) and version 4.8 of MapServer/ PHP MapScript.  On the Windows 
> system, everything is working; on Linux, everything is working except a 
> label layer. All of the relevant files are the same on both systems. The 
> layer is:
>
>   LAYER
>     NAME "Labels"
>     GROUP "Labels"
>     STATUS OFF
>     DATA "vicbird1878"
>     TYPE ANNOTATION
>     LABELITEM "LABEL"
>     MAXSCALE 150
>     SYMBOLSCALE 71
>     CLASS
>       LABEL
>         TYPE TRUETYPE
>         FONT "lucida-sans"
>         SIZE 9
>         POSITION UC
>         OFFSET 0 8
>         COLOR 0 0 0
>         BACKGROUNDCOLOR 255 255 255
>         MINSIZE 8
>         MAXSIZE 10
>         BUFFER 1
>       END
>     END
>   END
>
> There is also a raster layer and a point layer; the point layer uses the 
> same shape file as the annotation layer, and displays correctly on both 
> systems.
>
> With TYPE TRUETYPE, I get no labels on Linux (I do on Windows). If I run 
> tile.php directly (on the Linux server) in Firefox (with appropriate t, 
> l, g, s, etc. parameters) I get an  "internal server error (500)" 
> response in the browser, and the server log reports a segmentation fault 
> (the same tile.php URL produces the correct label on the Windows 
> system). If I change the layer to TYPE BITMAP, I get no error but still 
> get no labels -- the tiles are created but are blank (white). If I use 
> TrueType but change the FONT to something nonexistent ("xxxxx"), there 
> is also no error (and of course no label), which suggests that my font 
> set file is OK and the "lucida-sans" font file is being found.
>
> I noticed a problem report on the MapServer list about segmentation 
> faults with MS 4.8 and GD, but that had to do with antialiasing, which I 
> have not turned on (the server guys are looking into the bug anyway, in 
> case there is some antialiasing going on that I don't know about).
>
> Anyone have any idea what might be going wrong on the Linux server? I am 
> getting nowhere on this...
>
>
> David
>
>   


-- 

David Badke
Humanities Computing and Media Center
University of Victoria, BC, Canada



More information about the ka-Map-users mailing list