Opened 19 years ago

Closed 19 years ago

#1399 closed defect (fixed)

Mapscript/cloneMap/Processing

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/Java inside Tomcat. 
We encountered a crash in webObj.cloneMap() when 
a PROCESSING-statement was used inside a Layer-Block. 

My impression is, that there is a bug in mapcopy.c/msCopyLayer (?) 

I think: After the line 
      MS_COPYSTELEM(numprocessing); 
and before the loop 
      for (i = 0; i < dst->numprocessing; i++) {...} 
a memory-allocation for dst->processing is missing. 

I made a change: 
  MS_COPYSTELEM(numprocessing);  //OLD 
  // Allocating an initializing memory for processing-array. 
  // Must be dst->numprocessing+1 to be 0-terminated. 
  dst->processing 
     = numprocessing ?
          (char*) calloc(dst->numprocessing+1,sizeof(char*)) : 
          0; 
  for (i = 0; i < dst->numprocessing; i++) {   //OLD 
  ... 

I hope this is helpful. Greetings 
Benedikt Rothe

Change History (3)

comment:1 by sgillies@…, 19 years ago

Cc: warmerdam@… added
Status: newassigned
I think that code like this

for (i = 0; i < dst->numprocessing; i++) {
    msLayerAddProcessing(dst, msLayerGetProcessing(src, i));
}

is the best way to go. I'm cc'ing FrankW to get his advice on using the 
processing functions.

comment:2 by fwarmerdam, 19 years ago

Sean's proposal accomplishes the same thing, and somewhat more cleanly.  I 
would suggest it. 

comment:3 by sgillies@…, 19 years ago

Resolution: fixed
Status: assignedclosed
Fix committed to CVS HEAD (4.7) and branch-4-6 (mapcopy.c revision 1.40.2.1).
I've added a processing directive to one of the layers in the mapscript test
fixture and verified that the layer can be copied without problems.
Note: See TracTickets for help on using tickets.