[mapguide-commits] r9022 - in branches/3.1/MgDev: . Common/CoordinateSystem Common/Renderers

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Tue Aug 23 05:17:15 PDT 2016


Author: jng
Date: 2016-08-23 05:17:15 -0700 (Tue, 23 Aug 2016)
New Revision: 9022

Modified:
   branches/3.1/MgDev/
   branches/3.1/MgDev/Common/CoordinateSystem/CoordSysUtil.h
   branches/3.1/MgDev/Common/Renderers/AGGRenderer.cpp
Log:
Merged revision(s) 9018-9021 from trunk/MgDev:
Merged revision(s) 9017 from sandbox/adsk/3.0m/Common/CoordinateSystem:
#2735: Cannot read some user defined coordinate systems. 

The CsMap dictionary string encoding was changed to UTF8 (see ticket #2508 ?\226?\128?\139http://trac.osgeo.org/mapguide/ticket/2508). All strings in CsMap dictionaries were changed to UTF8 too. But if it is an user defined CS and the description of the CS contains characters which are not UTF8, loading the CS will fail. In order to load the CS, we remove invalid characters when loading it.


........
#2736: Server crash when layer contains complicate symbols https://trac.osgeo.org/mapguide/ticket/2736

It is a heap corruption defect. The issue is at line 1792~1814, Common\Renderers\AGGRenderer.cpp. There are minx and maxx which are double. Then we convert them to int. But in some special cases, the converted imaxx will be less than iminx. It results in some memory are corrupted in next operations. To fix the issue, we need to add a check for the values.
........
#2736: Server crash when layer contains complicate symbols https://trac.osgeo.org/mapguide/ticket/2736

Refine submission 9019.  
........
Merged revision(s) 9019-9020 from sandbox/adsk/3.1n:
#2736: Server crash when layer contains complicate symbols https://trac.osgeo.org/mapguide/ticket/2736

It is a heap corruption defect. The issue is at line 1792~1814, Common\Renderers\AGGRenderer.cpp. There are minx and maxx which are double. Then we convert them to int. But in some special cases, the converted imaxx will be less than iminx. It results in some memory are corrupted in next operations. To fix the issue, we need to add a check for the values.
........
#2736: Server crash when layer contains complicate symbols https://trac.osgeo.org/mapguide/ticket/2736

Refine submission 9019.  
........

........



Property changes on: branches/3.1/MgDev
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/2.4/MgDev:6749-6756,6777-6783,6785-6787,6789,6791-6794,6796-6801,6954-6962,6986-7006
/branches/2.6/MgDev:8276-8286,8288-8292,8297,8299,8301,8303,8314-8315,8318,8335,8340,8354-8355,8365,8373
/branches/3.0/MgDev:8658,8705,8710
/sandbox/VC140:8684-8759
/sandbox/adsk/2.6l:8727
/sandbox/adsk/3.0m:8563,8584,8607,8625,8694-8695
/sandbox/adsk/3.1n:8871,8895,8901,8912-8913,8921-8922,8942
/sandbox/jng/convenience_apis:8262-8268,8271-8363
/sandbox/jng/createruntimemap:7486-7555
/sandbox/jng/dwftk:8321-8324,8328-8329,8331,8352
/sandbox/jng/geos34x:8256-8259
/sandbox/jng/php56x:8975-8985
/sandbox/jng/rfc155:8872-8884
/sandbox/jng/tiling:8174-8208
/sandbox/jng/v30:8212-8227
/sandbox/rfc94:5099-5163
/trunk/MgDev:8955-8956,8969,8980-8981,8986,8996,9000,9004-9006,9010
   + /branches/2.4/MgDev:6749-6756,6777-6783,6785-6787,6789,6791-6794,6796-6801,6954-6962,6986-7006
/branches/2.6/MgDev:8276-8286,8288-8292,8297,8299,8301,8303,8314-8315,8318,8335,8340,8354-8355,8365,8373
/branches/3.0/MgDev:8658,8705,8710
/sandbox/VC140:8684-8759
/sandbox/adsk/2.6l:8727
/sandbox/adsk/3.0m:8563,8584,8607,8625,8694-8695
/sandbox/adsk/3.1n:8871,8895,8901,8912-8913,8921-8922,8942,9019-9020
/sandbox/jng/convenience_apis:8262-8268,8271-8363
/sandbox/jng/createruntimemap:7486-7555
/sandbox/jng/dwftk:8321-8324,8328-8329,8331,8352
/sandbox/jng/geos34x:8256-8259
/sandbox/jng/php56x:8975-8985
/sandbox/jng/rfc155:8872-8884
/sandbox/jng/tiling:8174-8208
/sandbox/jng/v30:8212-8227
/sandbox/rfc94:5099-5163
/trunk/MgDev:8955-8956,8969,8980-8981,8986,8996,9000,9004-9006,9010,9018-9021

Modified: branches/3.1/MgDev/Common/CoordinateSystem/CoordSysUtil.h
===================================================================
--- branches/3.1/MgDev/Common/CoordinateSystem/CoordSysUtil.h	2016-08-23 12:05:32 UTC (rev 9021)
+++ branches/3.1/MgDev/Common/CoordinateSystem/CoordSysUtil.h	2016-08-23 12:17:15 UTC (rev 9022)
@@ -101,7 +101,20 @@
   if (str == 0)
     return 0;
 
-  return MgUtil::MultiByteToWideChar(str);
+  // Check input, discard invalid charactors
+  size_t len = strlen(str);
+  char* tempstr = new char[len+1];
+  size_t pos = 0;
+  for (size_t i = 0; i < len; i++)
+  {
+      if (str[i] > 0)
+          tempstr[pos++] = str[i];
+  }
+  tempstr[pos] = '\0';
+
+  wchar_t* ret = MgUtil::MultiByteToWideChar(tempstr);
+  delete []tempstr;
+  return ret;
 }
 
 inline char *

Modified: branches/3.1/MgDev/Common/Renderers/AGGRenderer.cpp
===================================================================
--- branches/3.1/MgDev/Common/Renderers/AGGRenderer.cpp	2016-08-23 12:05:32 UTC (rev 9021)
+++ branches/3.1/MgDev/Common/Renderers/AGGRenderer.cpp	2016-08-23 12:17:15 UTC (rev 9022)
@@ -1806,9 +1806,12 @@
         // clear the affected region of the alpha mask
         agg::gray8 cc(0);
 
-        unsigned width = (int)imaxx - (int)iminx + 1;
-        for (int y=iminy; y<=imaxy; ++y)
-            c()->mask_pixf->copy_hline(iminx, y, width, cc);
+        if (imaxx >= iminx)
+        {        
+            unsigned width = (int)imaxx - (int)iminx + 1;
+            for (int y = iminy; y <= imaxy; ++y)
+                c()->mask_pixf->copy_hline(iminx, y, width, cc);
+        }
 
         // render the alpha mask polygon
         c()->mask_ren.color(agg::gray8(255));



More information about the mapguide-commits mailing list