Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

segfault in reading shapefile (6.3-dev) than gives nice error in 5.6.5 #4424

Closed
msmitherdc opened this issue Aug 14, 2012 · 6 comments
Closed
Assignees
Milestone

Comments

@msmitherdc
Copy link
Contributor

in trunk

(gdb) run QUERY_STRING="map=/tmp/testmap.map&map_imagetype=png24&mode=map&_olSalt=0.5053440353367478&LAYERS=day2_categorical_temp&mapext=-12953861.143352+3552385.3538292+-4551902.995414+7243376.5751498&imgext=-12953861.143352+3552385.3538292+-4551902.995414+7243376.5751498&map_size=1717+754&imgx=858.5&imgy=377&imgxy=1717+754"
Starting program: /usr/local/bin/mapserv QUERY_STRING="map=/tmp/testmap.map&map_imagetype=png24&mode=map&_olSalt=0.5053440353367478&LAYERS=day2_categorical_temp&mapext=-12953861.143352+3552385.3538292+-4551902.995414+7243376.5751498&imgext=-12953861.143352+3552385.3538292+-4551902.995414+7243376.5751498&map_size=1717+754&imgx=858.5&imgy=377&imgxy=1717+754"
[Thread debugging using libthread_db enabled]

Program received signal SIGSEGV, Segmentation fault.
0x00002aaaaabc4865 in msEvalExpression (layer=0x622100, shape=0x7fffffffe120, expression=0x623590, itemindex=0) at maputil.c:466
466         if(strcmp(expression->string, shape->values[itemindex]) == 0) return MS_TRUE; /* got a match */
(gdb) bt
#0  0x00002aaaaabc4865 in msEvalExpression (layer=0x622100, shape=0x7fffffffe120, expression=0x623590, itemindex=0) at maputil.c:466
#1  0x00002aaaaabc4e21 in msShapeGetClass (layer=0x622100, map=0x618b50, shape=0x7fffffffe120, classgroup=0x0, numclasses=4) at maputil.c:584
#2  0x00002aaaaac29a8d in msDrawVectorLayer (map=0x618b50, layer=0x622100, image=0x620930) at mapdraw.c:989
#3  0x00002aaaaac290a0 in msDrawLayer (map=0x618b50, layer=0x622100, image=0x6d0730) at mapdraw.c:808
#4  0x00002aaaaac27c79 in msDrawMap (map=0x618b50, querymap=0) at mapdraw.c:437
#5  0x00002aaaaacde2b9 in msCGIDispatchImageRequest (mapserv=0x617790) at mapservutil.c:1471
#6  0x00002aaaaacdee21 in msCGIDispatchRequest (mapserv=0x617790) at mapservutil.c:1713
#7  0x000000000040155a in main (argc=2, argv=0x7fffffffe748) at mapserv.c:257
(gdb) 

with 5.6.5

GNU gdb (GDB) Red Hat Enterprise Linux (7.0.1-42.el5)
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /oracle/product/10.1.3.2.0/OracleAS_1/Apache/Apache/cgi-bin/mapserv...done.
(gdb) run QUERY_STRING="map=/tmp/testmap.map&map_imagetype=png24&mode=map&_olSalt=0.5053440353367478&LAYERS=day2_categorical_temp&mapext=-12953861.143352+3552385.3538292+-4551902.995414+7243376.5751498&imgext=-12953861.143352+3552385.3538292+-4551902.995414+7243376.5751498&map_size=1717+754&imgx=858.5&imgy=377&imgxy=1717+754"
Starting program: /oracle/product/10.1.3.2.0/OracleAS_1/Apache/Apache/cgi-bin/mapserv QUERY_STRING="map=/tmp/testmap.map&map_imagetype=png24&mode=map&_olSalt=0.5053440353367478&LAYERS=day2_categorical_temp&mapext=-12953861.143352+3552385.3538292+-4551902.995414+7243376.5751498&imgext=-12953861.143352+3552385.3538292+-4551902.995414+7243376.5751498&map_size=1717+754&imgx=858.5&imgy=377&imgxy=1717+754"
[Thread debugging using libthread_db enabled]
Content-type: text/html

<HTML>
<HEAD><TITLE>MapServer Message</TITLE></HEAD>
<!-- MapServer version 5.6.5 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP OUTPUT=SVG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=ICONV SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER SUPPORTS=SOS_SERVER SUPPORTS=FASTCGI SUPPORTS=GEOS SUPPORTS=POINT_Z_M INPUT=EPPL7 INPUT=ORACLESPATIAL INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE -->
<BODY BGCOLOR="#FFFFFF">
msDrawMap(): Image handling error. Failed to draw layer named &#39;day2_categorical_temp&#39;.
msDBFReadAttribute(): DBASE file error. Invalid record number 1.
</BODY></HTML>
Program exited normally.
@jmckenna
Copy link
Member

I've tested this same shapefile on Windows with 6.2.0-beta2; mapserv.exe crashes, but before it does an error is displayed:

shp2img -m ticket4424.map -o ttt.png -map_debug 5
  msDrawMap(): rendering using outputformat named png (AGG/PNG).
  msDrawMap(): WMS/WFS set-up and query, 0.000s
  msDBFReadAttribute(): DBASE file error. Invalid record number 1.

@jmckenna
Copy link
Member

here is test package with Mike's problem shapefile and mapfile: http://labs.gatewaygeomatics.com/dl/ticket4424.zip (51 KB)

@jmckenna
Copy link
Member

I discovered that no error is produced and the map image is generated using CONNECTIONTYPE OGR instead; I've updated the test package for this step.

@ghost ghost assigned tbonfort Aug 21, 2012
@tbonfort
Copy link
Member

new output is now:

$ shp2img -m map/ticket4424.map -o ttt.png -all_debug 5
msLoadMap(): 0.001s
msDrawMap(): rendering using outputformat named png (AGG/PNG).
msDBFReadAttribute(): DBASE file error. Invalid record number 1.
msDrawMap(): Image handling error. Failed to draw layer named 'day2_categorical_temp'.
msDrawMap(): Image handling error. Failed to draw layer named 'day2_categorical_temp'. <br>
msDBFReadAttribute(): DBASE file error. Invalid record number 1. <br>
msFreeMap(): freeing map at 0x7faa6a01b800.
freeLayer(): freeing layer at 0x7faa69c156c0.

the request does halt though, but that's a sensible behavior if the shapefile is corrupt I believe.

tbonfort added a commit that referenced this issue Aug 21, 2012
@jmckenna
Copy link
Member

I've tested the changes on Windows and now the request halts at the error (no mapserv crash). Looks good here.

@tbonfort
Copy link
Member

thanks @jmckenna for the complete test case

mkofahl pushed a commit to faegi/mapserver that referenced this issue Apr 9, 2013
mkofahl pushed a commit to faegi/mapserver that referenced this issue Apr 9, 2013
mkofahl pushed a commit to faegi/mapserver that referenced this issue Apr 9, 2013
mkofahl pushed a commit to faegi/mapserver that referenced this issue Apr 9, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants