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

Steve Spicklemire steve at spvi.com
Tue Dec 2 15:56:12 EST 2003


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




More information about the mapserver-dev mailing list