[mapserver-commits] r7860 - branches/branch-5-2/mapserver

svn at osgeo.org svn at osgeo.org
Fri Aug 15 08:19:00 EDT 2008


Author: tamas
Date: 2008-08-15 08:19:00 -0400 (Fri, 15 Aug 2008)
New Revision: 7860

Modified:
   branches/branch-5-2/mapserver/HISTORY.TXT
   branches/branch-5-2/mapserver/mapagg.cpp
Log:
Masking the out-of-range characters to avoid the crash in the AGG renderer (#2739)

Modified: branches/branch-5-2/mapserver/HISTORY.TXT
===================================================================
--- branches/branch-5-2/mapserver/HISTORY.TXT	2008-08-15 12:01:52 UTC (rev 7859)
+++ branches/branch-5-2/mapserver/HISTORY.TXT	2008-08-15 12:19:00 UTC (rev 7860)
@@ -12,6 +12,10 @@
 
 Current Version (SVN branch-5-2)
 --------------------------------
+
+- Masking the out-of-range characters to avoid the crash
+  in the AGG renderer (#2739)
+
 - AGG: fix pixmap symbols not drawing if no color was specified (#2736)
 
 - Accept WMS requests in which the optional SERVICE param is missing. 

Modified: branches/branch-5-2/mapserver/mapagg.cpp
===================================================================
--- branches/branch-5-2/mapserver/mapagg.cpp	2008-08-15 12:01:52 UTC (rev 7859)
+++ branches/branch-5-2/mapserver/mapagg.cpp	2008-08-15 12:19:00 UTC (rev 7860)
@@ -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