[mapserver-users] Mapserv problems on Fedora

Stephen Woodbridge woodbri at swoodbridge.com
Mon Apr 14 18:38:40 EDT 2008


Hi Frank,

Adding more to to the malloc fixed the crash, but the regex is failing 
:( and should be ok:

Breakpoint 1, msEvalRegex (e=0x4e9873 "\\.map$",
     s=0x7232a0 "/u/data/maps/google-agg.map") at mapfile.c:79

...

89        if(ms_regexec(&re, s, 0, NULL, 0) != 0) { /* no match */
(gdb) p ms_regexec(&re, s, 0, 0, 0)
$1 = 1
(gdb) c
Continuing.
Content-type: text/html

<HTML>
<HEAD><TITLE>MapServer Message</TITLE></HEAD>
<!-- MapServer version 5.0.2 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG 
OUTPUT=WBMP OUTPUT=SVG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE 
SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER INPUT=EPPL7 
INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE -->
<BODY BGCOLOR="#FFFFFF">
msEvalRegex(): Regular expression error. String 
(/u/data/maps/google-agg.map) failed expression test.
</BODY></HTML>
Program exited normally.


This should NOT be happening. Arrrgh!
Anyone else using fc8 on a x86_84 box?

-Steve


Frank Warmerdam wrote:
> Stephen Woodbridge wrote:
>> ==32351== Invalid write of size 1
>> ==32351==    at 0x32FAA03144: rx_bzero (in /usr/lib64/librx.so.0.0.0)
>> ==32351==    by 0x32FAA08786: regncomp (in /usr/lib64/librx.so.0.0.0)
>> ==32351==    by 0x421BF2: msEvalRegex (mapfile.c:84)
>> ==32351==    by 0x42500E: msLoadMap (mapfile.c:4529)
>> ==32351==    by 0x40BD6B: loadMap (mapserv.c:201)
>> ==32351==    by 0x40D8FD: main (mapserv.c:1132)
>> ==32351==  Address 0x57A8820 is 0 bytes after a block of size 64 alloc'd
>> ==32351==    at 0x4A059F6: malloc (vg_replace_malloc.c:149)
>> ==32351==    by 0x4A9E44: ms_regcomp (mapregex.c:58)
>> ==32351==    by 0x421BF2: msEvalRegex (mapfile.c:84)
>> ==32351==    by 0x42500E: msLoadMap (mapfile.c:4529)
>> ==32351==    by 0x40BD6B: loadMap (mapserv.c:201)
>> ==32351==    by 0x40D8FD: main (mapserv.c:1132)
> 
> Steve,
> 
> Ugly! I don't know why it would be needed, but you could try changing this:
> 
>   regex_t* sys_regex = (regex_t*) malloc(sizeof(regex_t));
> 
> to:
> 
>   regex_t* sys_regex = (regex_t*) malloc(sizeof(regex_t)+1000);
> 
> in mapregex.c.
> 
> I suspect there is a mixup between the regex include files being
> used and the library being used or possibly structures aren't being
> sized properly due to some sort of type size issue.
> 
> Interestingly in my mapfile.c from the 5.0 branch line 84 of
> mapfile.c is:
> 
>   if(ms_regcomp(&re, e, MS_REG_EXTENDED|MS_REG_NOSUB) != 0) {
> 
> rather than calling regncomp() directly.  Perhaps there has been
> a fix since 5.0.2?
> 
> Best regards,



More information about the mapserver-users mailing list