[mapserver-commits] r7858 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Fri Aug 15 07:51:03 EDT 2008


Author: tamas
Date: 2008-08-15 07:51:03 -0400 (Fri, 15 Aug 2008)
New Revision: 7858

Modified:
   trunk/mapserver/mapagg.cpp
Log:
Masking the out-of-range characters to avoid the crash in the AGG renderer (#2739)

Modified: trunk/mapserver/mapagg.cpp
===================================================================
--- trunk/mapserver/mapagg.cpp	2008-08-15 07:45:55 UTC (rev 7857)
+++ trunk/mapserver/mapagg.cpp	2008-08-15 11:51:03 UTC (rev 7858)
@@ -645,9 +645,18 @@
         glyph.font(rasterfonts[size]);
         int numlines=0;
         char **lines;
+        /*masking out the out-of-range character codes*/
+        int len;
+        int cc_start = rasterfonts[size][2];
+        int cc_end = cc_start + rasterfonts[size][3];
         if((lines = msStringSplit((const char*)thechars, '\n', &(numlines))) == NULL)
             return(-1);
         for(int n=0;n<numlines;n++) {
+            len = strlen(lines[n]);
+            for (int i = 0; i < len; i++)
+            if (lines[n][i] < cc_start || lines[n][i] > cc_end)
+                lines[n][i] = '.';
+            
             if(outlinecolor.a) {
                 rt.color(outlinecolor);
                 for(int i=-1;i<=1;i++) {



More information about the mapserver-commits mailing list