This is an automated email from the ASF dual-hosted git repository.

borisk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/xerces-c.git

commit 7788124c91765f601fcfe79886cafe7d6f4dc383
Author: Scott Cantor <scan...@apache.org>
AuthorDate: Mon Dec 30 16:10:54 2019 +0000

    XERCESC-2158 - Multi-byte bug in UTF8 Transcoder
    
    git-svn-id: https://svn.apache.org/repos/asf/xerces/c/trunk@1872119 
13f79535-47bb-0310-9956-ffa450edef68
---
 src/xercesc/util/XMLUTF8Transcoder.cpp | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/xercesc/util/XMLUTF8Transcoder.cpp 
b/src/xercesc/util/XMLUTF8Transcoder.cpp
index de9fbcc..a477581 100644
--- a/src/xercesc/util/XMLUTF8Transcoder.cpp
+++ b/src/xercesc/util/XMLUTF8Transcoder.cpp
@@ -391,12 +391,13 @@ XMLUTF8Transcoder::transcodeFrom(const  XMLByte* const    
      srcData
             //
             //  If we have enough room to store the leading and trailing
             //  chars, then lets do it. Else, pretend this one never
-            //  happened, and leave it for the next time. Since we don't
-            //  update the bytes read until the bottom of the loop, by
-            //  breaking out here its like it never happened.
+            //  happened, and leave it for the next time.
             //
             if (outPtr + 1 >= outEnd)
+            {
+                srcPtr -= (trailingBytes + 1);
                 break;
+            }
 
             // Store the leading surrogate char
             tmpVal -= 0x10000;


---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscr...@xerces.apache.org
For additional commands, e-mail: c-dev-h...@xerces.apache.org

Reply via email to