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
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 @@
//
// 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;