[mapserver-commits] r11755 - branches/branch-5-6/mapserver

svn at osgeo.org svn at osgeo.org
Wed May 25 01:04:09 EDT 2011


Author: sdlime
Date: 2011-05-24 22:04:09 -0700 (Tue, 24 May 2011)
New Revision: 11755

Modified:
   branches/branch-5-6/mapserver/HISTORY.TXT
   branches/branch-5-6/mapserver/maperror.c
Log:
Fix segfault with png-inimage exceptions and quantize_force=on (#2903)

Modified: branches/branch-5-6/mapserver/HISTORY.TXT
===================================================================
--- branches/branch-5-6/mapserver/HISTORY.TXT	2011-05-24 17:44:09 UTC (rev 11754)
+++ branches/branch-5-6/mapserver/HISTORY.TXT	2011-05-25 05:04:09 UTC (rev 11755)
@@ -14,6 +14,8 @@
 Version 5.6.7 (SVN branch-5-6):
 ---------------------------
 
+- Fix segfault with png-inimage exceptions and quantize_force=on (#2903)
+
 - Fix segfault on malformed <PropertyIsLike> filters (#3888)
 
 - Fixed potential crash with AVERAGE resampling and crazy reprojection (#3886)

Modified: branches/branch-5-6/mapserver/maperror.c
===================================================================
--- branches/branch-5-6/mapserver/maperror.c	2011-05-24 17:44:09 UTC (rev 11754)
+++ branches/branch-5-6/mapserver/maperror.c	2011-05-25 05:04:09 UTC (rev 11755)
@@ -408,14 +408,26 @@
   if (format == NULL || (!MS_DRIVER_GD(format) && !MS_DRIVER_AGG(format))) 
     format = msCreateDefaultOutputFormat( NULL, "GD/PC256" );
 
-  img.img.gd = gdImageCreate(width, height);
-  color = gdImageColorAllocate(img.img.gd, map->imagecolor.red, 
-                               map->imagecolor.green,
-                               map->imagecolor.blue); /* BG color */
-  nBlack = gdImageColorAllocate(img.img.gd, 0,0,0); /* Text color */
+  if(format->imagemode == MS_IMAGEMODE_RGB || format->imagemode == MS_IMAGEMODE_RGBA) {
+    img.img.gd = gdImageCreateTrueColor(width, height);
+        gdImageAlphaBlending(img.img.gd, 0);
+    color = gdTrueColor(map->imagecolor.red,
+                        map->imagecolor.green,
+                        map->imagecolor.blue); /* BG color */
+    nBlack = gdTrueColor(0,0,0); /* Text color */
 
+    gdImageFilledRectangle(img.img.gd, 0, 0, width, height, color);
+
+  } else {
+    img.img.gd = gdImageCreate(width, height);
+    color = gdImageColorAllocate(img.img.gd, map->imagecolor.red, 
+                                 map->imagecolor.green,
+                                 map->imagecolor.blue); /* BG color */
+    nBlack = gdImageColorAllocate(img.img.gd, 0,0,0); /* Text color */
+  }
+
   if (map->outputformat && map->outputformat->transparent)
-    gdImageColorTransparent(img.img.gd, 0);
+    gdImageColorTransparent(img.img.gd, color);
 
 
   nTextLength = strlen(errormsg); 



More information about the mapserver-commits mailing list