Bug in msCopy

Benedikt Rothe umn-ms at HYDROTEC.DE
Wed Jun 29 04:33:39 EDT 2005


Dear List

We are using MapScript/Tomcat/Java/OracleSpatial.

We use mapObj.mapClone() to get a fresh mapObject 
in each request without reading the Mapfile.

We detected problems after we activated Connection-Pooling:
Tomcat crashed in mapObj.delete()

Hole thing turned out to be a bug in mapcopy.c where
the joins are copied:
--------------------
MS_COPYSTELEM(numjoins);

for (i = 0; i < dst->numprocessing; i++) {
   return_value = msCopyJoin(&(dst->joins[i]), &(src->joins[i]));
--------------------

This must be changed to
--------------------
MS_COPYSTELEM(numjoins);

for (i = 0; i < dst->numjoins; i++) {
   return_value = msCopyJoin(&(dst->joins[i]), &(src->joins[i]));
--------------------

There is some other code in mapobject.c, wich didn't 
raise any problems for us, but from wich I do think 
that array-allocs are missing.
I watched the code an *think* these are are not allocated 
anywhere. I hope, there is no misleading hint:

----------------------------
// I do think, that dst->point is not allocated.
// code seems to be unused (?)
dst->numpoints = src->numpoints;
for (i = 0; i < dst->numpoints; i++) {
  MS_COPYPOINT(&(dst->point[i]), &(src->point[i]));
}
----------------------------
// I do think, that dst->items and dst->values is
// not allocated
MS_COPYSTELEM(numitems);
for (i = 0; i < dst->numitems; i++) {
  MS_COPYSTRING(dst->items[i], src->items[i]);
  MS_COPYSTRING(dst->values[i], src->values[i]);
}

-----------------------------
// I'm quite shure, that dst->items is not allocated
MS_COPYSTELEM(numitems);

for (i = 0; i < dst->numitems; i++) {
  MS_COPYSTRING(dst->items[i], src->items[i]);
}

I hope this is helpful. Greetings
Benedikt Rothe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20050629/3434b086/attachment.html


More information about the mapserver-users mailing list