[mapserver-users] Fwd: segfault using msLayerGetShape
Steve Lime
steve.lime@dnr.state.mn.us
Wed, 24 Jul 2002 09:00:01 -0500
This is a MIME message. If you are reading this text, you may want to
consider changing to a mail reader or gateway that understands how to
properly handle MIME multipart messages.
--=_267A28FF.F495F6DB
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
--=_267A28FF.F495F6DB
Content-Type: message/rfc822
Received: from mail.state.mn.us
(state.mn.us [156.99.125.109])
by co5.dnr.state.mn.us; Wed, 24 Jul 2002 06:49:11 -0500
Return-Path: <sylvain.pasche@epfl.ch>
Received: from lists.gis.umn.edu by mail.state.mn.us with ESMTP for steve.lime@dnr.state.mn.us; Wed, 24 Jul 2002 06:49:11 -0500
Received: from dimail.epfl.ch (dimail.epfl.ch [128.178.79.31])
by lists.gis.umn.edu (8.9.3+Sun/8.9.1) with ESMTP id GAA17963
for <mapserver-bugs@lists.gis.umn.edu>; Wed, 24 Jul 2002 06:50:01 -0500 (CDT)
Received: from in3sun3.epfl.ch (daemon@in3sun3.epfl.ch [128.178.164.18])
by dimail.epfl.ch (8.8.X/EPFL-8.1g) with ESMTP id NAA27999
for <mapserver-bugs@lists.gis.umn.edu>; Wed, 24 Jul 2002 13:49:07 +0200 (MET DST)
Received: (from sypasche@localhost)
by in3sun3.epfl.ch (8.11.6+Sun/EPFL-8.1a) id g6OBn7a03976;
Wed, 24 Jul 2002 13:49:07 +0200 (MEST)
From: Sylvain Pasche <sylvain_pasche@yahoo.fr>
Message-Id: <15678.37939.408605.394880@in3sun3.epfl.ch>
Date: Wed, 24 Jul 2002 13:49:07 +0200
To: mapserver-bugs@lists.gis.umn.edu
Subject: segfault using msLayerGetShape
X-Mailer: VM 6.92 under 20.4 "Emerald" XEmacs Lucid
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
hi,
I'm using cvs mapserver version of yesterday.
I was trying to do the following in php mapscript:
I run a query with layer->queryByPoint, then get the resulcache:
for ($res_idx=0; $res_idx < $num_results; $res_idx++) {
$cache = $layer->getResult($res_idx);
and finally run the function:
$shape = $layer->getShape($cache->tileindex,
$cache->shapeindex)
which makes mapserver crash with a SEGMENTATION fault (I'm using
php-4.2.1 cgi)
I don't know if the problem is tied to php mapscript, ie if a
structure is not initialized correctly. Or I am doing something wrong
in the code sequence before.
here's the backtrace:
(gdb) bt
#0 0x40133bfe in obstack_exit_failure () from /lib/libc.so.6
#1 0x401e6718 in ?? ()
#2 0x40137f5b in errno () from /lib/libc.so.6
#3 0x4235d00f in msSHPReadShape (psSHP=0x83856c8, hEntity=20,
shape=0x82383b8) at mapshape.c:908
#4 0x42394302 in msLayerGetShape (layer=0x42a62b70, shape=0x82383b8,
tile=-1, record=20)
at maplayer.c:256
#5 0x423502f8 in layerObj_getShape (self=0x42a62b70, shape=0x82383b8,
tileindex=-1, shapeindex=20)
at mapscript_i.c:471
#6 0x423464bc in php3_ms_lyr_getShape (ht=2, return_value=0x82383a4,
this_ptr=0x8364d14,
return_value_used=1) at php_mapscript.c:6108
#7 0x080dd3b0 in ?? ()
#8 0x080dd57a in ?? ()
#9 0x080dd57a in ?? ()
Apparently the problem in is the fseek call in mapshape.c :
(gdb) fr 3
#3 0x4235d00f in msSHPReadShape (psSHP=0x83856c8, hEntity=20,
shape=0x82383b8) at mapshape.c:908
908 fseek( psSHP->fpSHP, psSHP->panRecOffset[hEntity], 0 );
The *FILE used seems to be wrong:
(gdb) p *psSHP->fpSHP
$2 = {_flags = 1075734032, _IO_read_ptr = 0x401e6730
"(g\036@(g\036@0g\036@",
_IO_read_end = 0x401e6738 "0g\036@", _IO_read_base = 0x401e6730
"(g\036@(g\036@0g\036@",
_IO_write_base = 0x401e6720 "8g\036@0g\036@ g\036@
g\036@(g\036@(g\036@0g\036@",
_IO_write_ptr = 0x401e6720 "8g\036@0g\036@ g\036@
g\036@(g\036@(g\036@0g\036@",
_IO_write_end = 0x401e6728 " g\036@ g\036@(g\036@(g\036@0g\036@",
_IO_buf_base = 0x401e6728 " g\036@ g\036@(g\036@(g\036@0g\036@",
_IO_buf_end = 0x401e6730 "(g\036@(g\036@0g\036@", _IO_save_base =
0x0, _IO_backup_base = 0x0,
_IO_save_end = 0x0, _markers = 0x401e6740, _chain = 0x401e6740,
_fileno = 1075734344,
_blksize = 1075734344, _old_offset = 1075734352, _cur_column =
26448,
_vtable_offset = 30 '\036', _shortbuf = "@", _lock = 0x401e6758,
_offset = 4620243930818963288,
__pad1 = 0x401e6760, __pad2 = 0x401e6768, _mode = 1075734376,
_unused2 =
"pg\036@pg\036@xg\036@xg\036@\020b8\b\020b8\b\210g\036@\210g\036@\220g\036@\220g\036@\230g\036@\230g\036@
g\036@"}
the filepointer seems rather high.
Don't know if this is a compiler/gdb artifact, but it seems like the
file initialisation (*psSHP->fpSHP *FILE pointer) might not be done
properly. Or perhaps is overwritten somewhere..
Just ask me if you need more infos.
Sylvain
--=_267A28FF.F495F6DB--