[Xastir-dev] Core dump due to indexing array with char
Magne Mæhre
magne at samfundet.no
Sun Mar 16 15:48:25 EDT 2008
While I was playing with converting OpenStreetMap[1] data to shape files
for Xastir tonight, I stumbled across a problem where xastir
consistently core dumped.
The problem was that a string read from the dbf file contained a
character (tex: /Oslash ) that was mapped to a negative value.
When the character was used as an index to the label_hash array
in draw_shapefile_map (map_shp.c:2914)
ptr2 = label_hash[-40]
a core dump resulted.
A quick fix was to change to type of 'temp' to unsigned char * to
force it to be positive:
map_shp.c:
l:1923 changed to "const unsigned char *temp;"
...but I guess a better solution would be to have a more explicit
type conversion instead of relying on the implicit (and
implementation defined) conversion?
--Magne / LA1BFA
[1] http://www.openstreetmap.org/ http://wiki.openstreetmap.org/
More information about the Xastir-dev
mailing list