You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by ca...@apache.org on 2005/10/12 15:20:50 UTC

svn commit: r314894 - /xerces/c/trunk/src/xercesc/util/XMLAbstractDoubleFloat.cpp

Author: cargilld
Date: Wed Oct 12 06:20:49 2005
New Revision: 314894

URL: http://svn.apache.org/viewcvs?rev=314894&view=rev
Log:
Check for valid schema characters for float and double.

Modified:
    xerces/c/trunk/src/xercesc/util/XMLAbstractDoubleFloat.cpp

Modified: xerces/c/trunk/src/xercesc/util/XMLAbstractDoubleFloat.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/trunk/src/xercesc/util/XMLAbstractDoubleFloat.cpp?rev=314894&r1=314893&r2=314894&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/XMLAbstractDoubleFloat.cpp (original)
+++ xerces/c/trunk/src/xercesc/util/XMLAbstractDoubleFloat.cpp Wed Oct 12 06:20:49 2005
@@ -105,9 +105,29 @@
         // work.
         static const unsigned int  maxStackSize = 100;
 
-        const unsigned int  lenTempStrValue =
-            XMLString::stringLen(tmpStrValue);
+        unsigned int  lenTempStrValue = 0;
 
+        
+        // Need to check that the string only contains valid schema characters
+        // since the call to strtod may allow other values.  For example, AIX
+        // allows "infinity" and "+INF"
+        XMLCh curChar;
+        while (curChar = tmpStrValue[lenTempStrValue]) {            
+            if (!(curChar >= chDigit_0 ||
+                  curChar <= chDigit_9 ||
+                  curChar == chPeriod  ||
+                  curChar == chDash    ||
+                  curChar == chPlus    ||
+                  curChar == chLatin_E ||
+                  curChar == chLatin_e)) {
+                ThrowXMLwithMemMgr(
+                    NumberFormatException,
+                    XMLExcepts::XMLNUM_Inv_chars,
+                    getMemoryManager());
+            }            
+            lenTempStrValue++;
+        }
+       
         if (lenTempStrValue < maxStackSize)
         {
             char    buffer[maxStackSize + 1];



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org