[Mapserver-dev] bug in mapswf.c (msDrawLabelCacheSWF)?

Steve Spicklemire steve at spvi.com
Tue Dec 9 06:58:55 EST 2003


Hi Yewondwossen,

Here's another patch to try. I was getting text cached on the wrong  
layers.. tracked it down to this:

Index: mapswf.c
===================================================================
RCS file: /data2/cvsroot/mapserver/mapswf.c,v
retrieving revision 1.33
diff -a -u -r1.33 mapswf.c
--- mapswf.c    3 Dec 2003 02:03:41 -0000       1.33
+++ mapswf.c    9 Dec 2003 11:56:18 -0000
@@ -2069,7 +2069,7 @@
      {
          for (i=0; i<nSize; i++)
          {
-            if (panIndex[i] = nIndex)
+            if (panIndex[i] == nIndex)
              {
                  nIndice = i;
                  break;

On Dec 3, 2003, at 10:22 AM, Yewondwossen Assefa wrote:

> Hi There,
>
>  I have commited mapswf.c and map.h with the fix and you can get them  
> from CVS. Let me know how it goes.
>
> Later,
>
> Steve Spicklemire wrote:
>> Hi Yewondwossen,
>> Yes.. please send me your patch.. and I'll test it!
>> thanks,
>> -steve
>> On Dec 2, 2003, at 4:55 PM, Yewondwossen Assefa wrote:
>>> Hi There,
>>>
>>>  Thanks for pointing this out.
>>>
>>>  I have done the modifications to the source code to avoid the  
>>> problem.
>>>
>>>   Although the changes you did should avoid the crash, there was a  
>>> potential error when assigning image->img.swf->nCurrentMovie =  
>>> cachePtr->layerindex since the movie index and the layer index are  
>>> not in sync. The crash happened for layerindex > nLayerMovies but  
>>> the assignment could also be wrong without a crash.
>>>
>>> If you are willing to do the tests please contact me personally and  
>>> I will send you the modifications before commiting the code. If not  
>>> I will enter a bug and  commit the code when I will do proper  
>>> testing on my side.
>>>
>>> Late
>>>
>>>
>>> Steve Spicklemire wrote:
>>>
>>>> Hi (again) Mapserver folks,
>>>> I have a map where msDrawLabelCacheSWF segfaults mapserver when  
>>>> OUTPUT_MOVIE=MULTIPLE. The problem is that if the last layer is not  
>>>> drawn, drawMap still tries to cache labels on that layer, and  
>>>> (mistakenly) tries to access the movie for that layer, which  
>>>> immediately segfaults since there is no movie for that layer  
>>>> (drawlayer never calls startlayer if the layer isn't visible).
>>>> Anyway... this patch stops the crashing for me:
>>>> Index: mapswf.c
>>>> ===================================================================
>>>> RCS file: /data2/cvsroot/mapserver/mapswf.c,v
>>>> retrieving revision 1.31
>>>> diff -C3 -r1.31 mapswf.c
>>>> *** mapswf.c    16 Jul 2003 16:44:58 -0000      1.31
>>>> --- mapswf.c    2 Dec 2003 20:53:18 -0000
>>>> ***************
>>>> *** 2119,2128 ****
>>>>   /*      set the current layer so the label will be drawn in the    
>>>>       */
>>>>   /*      using the correct SWF handle.                              
>>>>       */
>>>>   /*  
>>>> ==================================================================== 
>>>>  */
>>>> !         image->img.swf->nCurrentMovie = cachePtr->layerindex;
>>>> !         //msImageStartLayerSWF(map, layerPtr, image);
>>>> !         image->img.swf->nCurrentLayerIdx = cachePtr->layerindex;
>>>>   /*  
>>>> ==================================================================== 
>>>>  */
>>>>   /*      at this point the layer (at the shape level is closed).  
>>>> So      */
>>>>   /*      we will open it if necessary.                              
>>>>       */
>>>> --- 2119,2134 ----
>>>>   /*      set the current layer so the label will be drawn in the    
>>>>       */
>>>>   /*      using the correct SWF handle.                              
>>>>       */
>>>>   /*  
>>>> ==================================================================== 
>>>>  */
>>>> !
>>>> !       if (cachePtr->layerindex >= image->img.swf->nLayerMovies) {
>>>> !         continue;
>>>> !       }
>>>> !
>>>> !       image->img.swf->nCurrentMovie = cachePtr->layerindex;
>>>> !
>>>> !       //msImageStartLayerSWF(map, layerPtr, image);
>>>> !       image->img.swf->nCurrentLayerIdx = cachePtr->layerindex;
>>>>   /*  
>>>> ==================================================================== 
>>>>  */
>>>>   /*      at this point the layer (at the shape level is closed).  
>>>> So      */
>>>>   /*      we will open it if necessary.                              
>>>>       */
>>>> I've not seen any trouble with it so far..
>>>> -steve
>>>> _______________________________________________
>>>> Mapserver-dev mailing list
>>>> Mapserver-dev at lists.gis.umn.edu
>>>> http://lists.gis.umn.edu/mailman/listinfo/mapserver-dev
>>>
>>>
>>>
>>> -- 
>>> ----------------------------------------------------------------
>>> Assefa Yewondwossen
>>> Software Analyst
>>>
>>> Email: assefa at dmsolutions.ca
>>> http://www.dmsolutions.ca/
>>>
>>> Phone: (613) 565-5056 (ext 14)
>>> Fax:   (613) 565-0925
>>> ----------------------------------------------------------------
>>>
>>>
>>>
>>> _______________________________________________
>>> Mapserver-dev mailing list
>>> Mapserver-dev at lists.gis.umn.edu
>>> http://lists.gis.umn.edu/mailman/listinfo/mapserver-dev
>
>
> -- 
> ----------------------------------------------------------------
> Assefa Yewondwossen
> Software Analyst
>
> Email: assefa at dmsolutions.ca
> http://www.dmsolutions.ca/
>
> Phone: (613) 565-5056 (ext 14)
> Fax:   (613) 565-0925
> ----------------------------------------------------------------
>
>




More information about the mapserver-dev mailing list