Opened 19 years ago

Closed 19 years ago

#1403 closed defect (fixed)

Bug in msCopy

Reported by: umn-ms@… Owned by: sgillies@…
Priority: high Milestone:
Component: MapServer C Library Version: 4.6
Severity: normal Keywords:
Cc:

Description

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]);
}

Change History (1)

comment:1 by sgillies@…, 19 years ago

Resolution: fixed
Status: newclosed
I'm leaving msCopyLine alone for the present, but I did fix the copying of layer
and join items. These are now *not* copied, as they will be set when layers are
opened and joins are made. Changes committed to CVS HEAD and branch-4-6, revision
1.40.2.2 of mapcopy.c

Thanks for the bug reports!
Note: See TracTickets for help on using tickets.