Out of bounds read in XMLUTF8Transcoder::transcodeFrom
------------------------------------------------------

         Key: XERCESC-1612
         URL: http://issues.apache.org/jira/browse/XERCESC-1612
     Project: Xerces-C++
        Type: Bug

  Components: Miscellaneous  
    Versions: 2.7.0    
    Reporter: Daniel Burr
    Priority: Trivial


The test for character conversion is:
while (*srcPtr <= 127 && srcPtr != srcEnd && outPtr != outEnd );

This can give an error in valgrind because srcPtr is being dereferenced before 
the check is done to see if it is at the end.  The error can be fixed with 
something like:
while (srcPtr != srcEnd && *srcPtr <= 127 && outPtr != outEnd );

--- XMLUTF8Transcoder.cpp.orig  2006-06-30 14:28:35.000000000 +1000
+++ XMLUTF8Transcoder.cpp       2006-06-30 14:28:39.000000000 +1000
@@ -154,8 +154,8 @@
             do
             {
                 *outPtr++ = XMLCh(*srcPtr++);
-            } while (*srcPtr <= 127    &&
-                      srcPtr != srcEnd &&
+            } while ( srcPtr != srcEnd &&
+                     *srcPtr <= 127    &&
                       outPtr != outEnd );
             memset(sizePtr,1,srcPtr - srcPtr_save);
             sizePtr += srcPtr - srcPtr_save;

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to