[mapserver-commits] r8498 - trunk/mapserver
svn at osgeo.org
svn at osgeo.org
Wed Feb 4 15:39:37 EST 2009
Author: aboudreault
Date: 2009-02-04 15:39:36 -0500 (Wed, 04 Feb 2009)
New Revision: 8498
Modified:
trunk/mapserver/HISTORY.TXT
trunk/mapserver/mapwms.c
Log:
WMS request with LAYERS parameter: may cause segmentation fault (#2871)
Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT 2009-02-04 16:59:31 UTC (rev 8497)
+++ trunk/mapserver/HISTORY.TXT 2009-02-04 20:39:36 UTC (rev 8498)
@@ -12,6 +12,8 @@
Current Version (5.3-dev, SVN trunk):
------------------------------------
+- Fixed WMS request with LAYERS parameter: may cause segmentation fault (#2871)
+
- fix when layer status = DEFAULT and passing list of layers (#2066)
- Fixed msAddLabel may cause access violation in certain conditions
Modified: trunk/mapserver/mapwms.c
===================================================================
--- trunk/mapserver/mapwms.c 2009-02-04 16:59:31 UTC (rev 8497)
+++ trunk/mapserver/mapwms.c 2009-02-04 20:39:36 UTC (rev 8498)
@@ -415,6 +415,7 @@
if (strcasecmp(names[i], "LAYERS") == 0)
{
int j, k, iLayer;
+ int *layerOrder = (int*)malloc(map->numlayers * sizeof(int));
layers = msStringSplit(values[i], ',', &numlayers);
if (layers==NULL || strlen(values[i]) <=0 || numlayers < 1) {
@@ -425,7 +426,10 @@
for (iLayer=0; iLayer < map->numlayers; iLayer++)
+ {
map->layerorder[iLayer] = iLayer;
+ layerOrder[iLayer] = 0;
+ }
for(j=0; j<map->numlayers; j++)
{
@@ -434,7 +438,10 @@
if (GET_LAYER(map, j)->status != MS_DEFAULT)
GET_LAYER(map, j)->status = MS_OFF;
else
+ {
map->layerorder[nLayerOrder++] = j;
+ layerOrder[j] = 1;
+ }
}
for (k=0; k<numlayers; k++)
@@ -450,8 +457,12 @@
{
if (GET_LAYER(map, j)->status != MS_DEFAULT)
{
- map->layerorder[nLayerOrder++] = j;
- GET_LAYER(map, j)->status = MS_ON;
+ if (layerOrder[j] == 0)
+ {
+ map->layerorder[nLayerOrder++] = j;
+ layerOrder[j] = 1;
+ GET_LAYER(map, j)->status = MS_ON;
+ }
}
validlayers++;
layerfound = 1;
@@ -466,9 +477,11 @@
for (j=0; j<map->numlayers; j++)
{
if (GET_LAYER(map, j)->status == MS_OFF)
- map->layerorder[nLayerOrder++] = j;
+ if (layerOrder[j] == 0)
+ map->layerorder[nLayerOrder++] = j;
}
-
+
+ free(layerOrder);
msFreeCharArray(layers, numlayers);
}
else if (strcasecmp(names[i], "STYLES") == 0) {
More information about the mapserver-commits
mailing list