xerces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amass...@apache.org
Subject svn commit: r655703 - /xerces/c/trunk/src/xercesc/dom/impl/DOMLSSerializerImpl.cpp
Date Tue, 13 May 2008 00:37:47 GMT
Author: amassari
Date: Mon May 12 17:37:47 2008
New Revision: 655703

URL: http://svn.apache.org/viewvc?rev=655703&view=rev
Log:
Don't blindly subtract a number from an unsigned int, it could overflow (XERCESC-1804)

Modified:
    xerces/c/trunk/src/xercesc/dom/impl/DOMLSSerializerImpl.cpp

Modified: xerces/c/trunk/src/xercesc/dom/impl/DOMLSSerializerImpl.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/dom/impl/DOMLSSerializerImpl.cpp?rev=655703&r1=655702&r2=655703&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/dom/impl/DOMLSSerializerImpl.cpp (original)
+++ xerces/c/trunk/src/xercesc/dom/impl/DOMLSSerializerImpl.cpp Mon May 12 17:37:47 2008
@@ -1591,11 +1591,15 @@
     {
         if (fLastWhiteSpaceInTextNode)
         {
-            level -= fLastWhiteSpaceInTextNode/2; // two chSpaces equals one indent level
+            unsigned int indentLevel = fLastWhiteSpaceInTextNode/2; // two chSpaces equals
one indent level
             fLastWhiteSpaceInTextNode = 0;
             // if fLastWhiteSpaceInTextNode/2 is greater than level, then
             // it means too many spaces have been written to the
             // output stream and we can no longer indent properly
+            if(indentLevel < level)
+                level -= indentLevel;
+            else
+                level = 0;
         }
 
         for(unsigned int i = 0; i < level; i++)



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


Mime
View raw message