MapServer / MapServer-import

3 stars 2 forks source link

Infinite loop in msStringConcatenate from msGetErrorString #2202

Closed tbonfort closed 12 years ago

tbonfort commented 12 years ago

Reporter: hobu Date: 2007/08/03 - 07:12 This code goes on forever if msAddSymbol fails

http://trac.osgeo.org/mapserver/browser/trunk/mapserver/maperror.c?rev=6453#L303

Here's gdb capture:

Program received signal SIGINT, Interrupt.
0x010b9255 in msStringConcatenate (pszDest=0x650e000 "msAddImageSymbol(): Unable to access file. Error opening image file /Users/hobu/svn/spatialreferences/graticules/./1.\nmsAddImageSymbol(): Unable to access file. Error opening image file /Users/hobu/sv"..., pszSrc=0x1135150 "\n") at mapstring.c:789
789           nLen = strlen(pszDest) + strlen(pszSrc);
(gdb) bt
#0  0x010b9255 in msStringConcatenate (pszDest=0x650e000 "msAddImageSymbol(): Unable to access file. Error opening image file /Users/hobu/svn/spatialreferences/graticules/./1.\nmsAddImageSymbol(): Unable to access file. Error opening image file /Users/hobu/sv"..., pszSrc=0x1135150 "\n") at mapstring.c:789
#1  0x010b6689 in msGetErrorString (delimiter=0x1135150 "\n") at maperror.c:307
#2  0x01008eb9 in _raise_ms_exception () at mapscript_wrap.c:2808
tbonfort commented 12 years ago

Author: hobu Date: 2007/08/03 - 07:26 The actual problem is the default here:

http://trac.osgeo.org/mapserver/browser/trunk/mapserver/maputil.c?rev=6378#L133

tbonfort commented 12 years ago

Author: hobu Date: 2007/08/03 - 07:33

MAP
  EXTENT -180 -90 180 90
  FONTSET "/Users/hobu/svn/mapserver/tests/fonts.txt"
  IMAGECOLOR 255 255 255
  IMAGETYPE image/png
  SIZE 400 400
  STATUS ON
  UNITS METERS
  NAME "MS"

  DEBUG 1
  OUTPUTFORMAT
    NAME "png"
    MIMETYPE "image/png"
    DRIVER "GD/PNG"
    EXTENSION "png"
    IMAGEMODE "PC256"
    TRANSPARENT FALSE
  END

SYMBOL
  NAME "circle"
  TYPE ellipse
  FILLED true
  POINTS
    1 1
  END
END

  LAYER
    CLASSITEM "TYPE"
    DATA "data/graticule.shp"
    DEBUG 1
    LABELITEM "VALUE"

    NAME "base_layer"
    PROJECTION
      "init=epsg:4326"
    END
    STATUS DEFAULT
    TYPE LINE
    UNITS METERS
    CLASS
      EXPRESSION ([TYPE] EQ 1)
      LABEL

        ANTIALIAS TRUE
        FONT "Vera"
        SIZE 6
        TYPE TRUETYPE
        COLOR 255 0 0
        FORCE FALSE
        MINDISTANCE 200
        MINFEATURESIZE -1

        PARTIALS TRUE
        POSITION AUTO
      END

      STYLE

        COLOR 0 0 255
        WIDTH 3
        SYMBOL "circle"
      END

    END

  END

END
tbonfort commented 12 years ago

Author: dmorissette Date: 2007/08/03 - 22:52 Checking ...

What request do you use to reproduce this? Just running shp2img on the mapfile doesn't produce an error

tbonfort commented 12 years ago

Author: hobu Date: 2007/08/03 - 23:42 Python MapScript.

import mapscript

mo = mapscript.mapObj('render.map')

# Mollweide Projection
mo.setSize(600, 300)
mo.setProjection('+proj=moll +lon_0=0.0')
mo.setExtent(-18100000, -9050000, 18100000, 9050000)
im = mo.draw()
im.save('graticule-moll.png')

mo.setSize(400, 400)
mo.setProjection('+proj=ortho +lon_0=0.0 +lat_0=40.0')
mo.setExtent(-6400000,-6400000,6400000,6400000)
im = mo.draw()
im.save('graticule-ortho.png')
tbonfort commented 12 years ago

Author: hobu Date: 2007/08/06 - 18:18 This was caused by the heap corruption of #2205