[Mapserver-dev] 24-bit image processing crash
Brent Fraser
bfraser at geoanalytic.com
Sat Jan 18 13:52:26 EST 2003
This is a multi-part message in MIME format.
------=_NextPart_000_012C_01C2BEE8.12067B60
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Frank,
I've got a build of Mapserver on Win2k (nightly snapshot from =
2003/01/14, GD-2.0.10,with GDAL-1.1.8). It crashes when I have a CLASS =
defined for a raster layer of a 24-bit tif:
LAYER
NAME 'TopoMaps'
GROUP "Raster Backdrops"=20
TYPE raster
STATUS on
PROJECTION
"proj=3Dutm"
"ellps=3DWGS84"
"zone=3D12"
"north"
END
DATA 'C:\Inetpub\wwwroot\modis\site\basemap\072l12nc_83_24.tif'
# DATA 'C:\Inetpub\wwwroot\modis\site\basemap\072l12nc_83.tif'
CLASS
NAME "1:50k Topomaps"
END
END # LAYER
But doesn't crash when the tif is 8-bit /paletted (then it renders all =
the pixels as blue, but that's a different problem).
In the debugger it shows it's caused by msDrawRasterLayerGDAL =
(mapdrawgdal.c around line 414) :
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
/*
* Setup the mapping between source eightbit pixel values, and the
* output images color table. There are two general cases, where the
* class colors are provided by the MAP file, or where we use the =
native
* color table.
*/
if(layer->numclasses > 0 && gdImg ) {
int c;
cmap_set =3D TRUE;
for(i=3D0; i<GDALGetColorEntryCount(hColorMap); i++) {
GDALColorEntry sEntry;
colorObj pixel;
GDALGetColorEntryAsRGB( hColorMap, i, &sEntry );
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
It appears to crash since hColorMap is NULL and the called function =
attempts to access it's data members.
I'm not clear why msDrawRasterLayerGDAL is trying to do ColorMap =
processing on a 24-bit image.
Any thoughts?
Brent Fraser
GeoAnalytic Inc.
Tel:(403) 213-2700
bfraser at geoanalytic.com
www.geoanalytic.com
------=_NextPart_000_012C_01C2BEE8.12067B60
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2600.0" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Frank,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2> I've got a build of Mapserver on =
Win2k=20
(nightly snapshot from 2003/01/14, GD-2.0.10,with GDAL-1.1.8). It =
crashes=20
when I have a CLASS defined for a raster layer of a 24-bit =
tif:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>LAYER<BR> NAME =
'TopoMaps'<BR> GROUP=20
"Raster Backdrops" <BR> TYPE raster<BR> STATUS =
on<BR> =20
PROJECTION<BR> "proj=3Dutm"<BR> =20
"ellps=3DWGS84"<BR> =
"zone=3D12"<BR> =20
"north"<BR> END<BR> DATA=20
'C:\Inetpub\wwwroot\modis\site\basemap\072l12nc_83_24.tif'<BR># =
DATA=20
'C:\Inetpub\wwwroot\modis\site\basemap\072l12nc_83.tif'<BR> &n=
bsp;=20
CLASS<BR> NAME "1:50k =
Topomaps"<BR> =20
END<BR>END # LAYER</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>But doesn't crash when the tif is 8-bit =
/paletted=20
(then it renders all the pixels as blue, but that's a different=20
problem).</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>In the debugger it shows =
it's caused=20
by msDrawRasterLayerGDAL (mapdrawgdal.c around line=20
414) :</FONT></DIV>
<DIV><FONT face=3DArial=20
size=3D2>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D</FO=
NT></DIV>
<DIV><FONT face=3DArial size=3D2> /*<BR> * Setup the =
mapping=20
between source eightbit pixel values, and the<BR> * output =
images=20
color table. There are two general cases, where =
the<BR> *=20
class colors are provided by the MAP file, or where we use the=20
native<BR> * color table.<BR> */<BR> =20
if(layer->numclasses > 0 && gdImg ) =
{<BR> int=20
c;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2> cmap_set =3D =
TRUE;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2> for(i=3D0;=20
i<GDALGetColorEntryCount(<STRONG>hColorMap</STRONG>); i++)=20
{<BR> GDALColorEntry=20
sEntry;<BR> colorObj=20
pixel;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial =
size=3D2> =20
GDALGetColorEntryAsRGB( hColorMap, i, &sEntry );</FONT></DIV>
<DIV><FONT face=3DArial=20
size=3D2>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D<=
/FONT></DIV>
<DIV><FONT face=3DArial size=3D2>It appears to crash since hColorMap is =
NULL and the=20
called function attempts to access it's data members.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I'm not clear why msDrawRasterLayerGDAL =
is trying=20
to do ColorMap processing on a 24-bit image.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Any thoughts?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Brent Fraser</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>GeoAnalytic Inc.<BR>Tel:(403) =
213-2700<BR><A=20
href=3D"mailto:bfraser at geoanalytic.com">bfraser at geoanalytic.com</A><BR><A=
=20
href=3D"http://www.geoanalytic.com">www.geoanalytic.com</A></FONT></DIV><=
/BODY></HTML>
------=_NextPart_000_012C_01C2BEE8.12067B60--
More information about the mapserver-dev
mailing list