Ticket #4062 (closed defect: fixed)
segfault when calling classObj::updateFromString() with SYMBOL
| Reported by: | bishopb | Owned by: | aboudreault |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | MapScript-PHP | Version: | 6.0 |
| Severity: | normal | Keywords: | updateFromString |
| Cc: |
Description
<?php
// create a map with a layer and get that layer
$map =<<<EOTXT
MAP
NAME 'test'
SIZE 400 400
EXTENT 0 0 100 100
SYMBOL
NAME 'POINT'
TYPE ELLIPSE
POINTS
1 1
END
FILLED TRUE
END
LAYER
NAME 'Airports'
STATUS ON
TYPE point
FEATURE POINTS 10 10 50 50 1 50 70 10 END END
END
END
EOTXT;
$oMap = ms_newMapObjFromString($map);
$oLayer = $oMap->getLayerByName('Airports');
// add a class to that layer
$class =<<<EOTXT
CLASS
STYLE
COLOR 128 0 0
SYMBOL 'POINT'
SIZE 10
OUTLINECOLOR 0 0 0
WIDTH 5
END
END
EOTXT;
$oClass = new classObj($oLayer);
$oClass->updateFromString($class); // segfaults
$oMap->selectOutputFormat('png');
$oMap->draw()->saveImage('output.png');
?>
On:
AERES2-dev aeres # uname -a
Linux AERES2-dev 2.6.35-gentoo-r12 #1 Fri Dec 3 07:06:35 EST 2010 i686 AMD Athlon(tm) 64 Processor 3000+ AuthenticAMD GNU/Linux
AERES2-dev aeres # php -v
PHP 5.3.6-pl0-gentoo (cli) (built: Jul 24 2011 17:21:31)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans
with test_helpers v1.0.1-dev, Copyright (c) 2009-2010, by Johannes Schlueter, Scott MacVicar, Sebastian Bergmann
AERES2-dev aeres # php -r 'echo ms_GetVersion();'
MapServer version 6.0.0 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=ICONV SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER SUPPORTS=GEOS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILEAERES2-d
Last few bits of strace:
AERES2-dev aeres # strace php try.php 2>&1 | tail -20
munmap(0xb7213000, 888) = 0
close(3) = 0
munmap(0xb78b5000, 4096) = 0
gettimeofday({1319662528, 909732}, NULL) = 0
gettimeofday({1319662528, 910644}, NULL) = 0
open("/usr/share/proj/proj_def.dat", O_RDONLY) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=261, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb78b5000
read(3, "# Projection library defaults fi"..., 4096) = 261
_llseek(3, 0, [0], SEEK_SET) = 0
read(3, "# Projection library defaults fi"..., 4096) = 261
read(3, "", 4096) = 0
close(3) = 0
munmap(0xb78b5000, 4096) = 0
getcwd("/opt/aeres", 1024) = 11
gettimeofday({1319662528, 922518}, NULL) = 0
gettimeofday({1319662528, 923561}, NULL) = 0
gettimeofday({1319662528, 924505}, NULL) = 0
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++
The segfault occurs regardless of whether the class is instantiated by "new classObj($oLayer)" or "$oLayer->getClass(0)".
If the CLASS definition is moved into the LAYER in $map, and the updateFromString() business is skipped, the expected output is rendered.
See also Bug 3273 and Bug 2219.
Change History
Note: See
TracTickets for help on using
tickets.
