Don't report a transcoding error if the invalid character is not at the start of the buffer, it could be an incomplete buffer (XERCESC-1936)

git-svn-id: https://svn.apache.org/repos/asf/xerces/c/branches/xerces-2@1224887 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/xercesc/util/Transcoders/ICU/ICUTransService.cpp b/src/xercesc/util/Transcoders/ICU/ICUTransService.cpp
index 8f7eefb..f46df8d 100644
--- a/src/xercesc/util/Transcoders/ICU/ICUTransService.cpp
+++ b/src/xercesc/util/Transcoders/ICU/ICUTransService.cpp
@@ -677,7 +677,7 @@
     );
 
     // Rememember the status before we possibly overite the error code
-    const bool res = (err == U_ZERO_ERROR);
+    const bool res = ((err == U_ZERO_ERROR) || (err == U_BUFFER_OVERFLOW_ERROR && startSrc > srcPtr));
 
     // Put the old handler back
     err = U_ZERO_ERROR;
diff --git a/src/xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.cpp b/src/xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.cpp
index 2f3e55a..c793080 100644
--- a/src/xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.cpp
+++ b/src/xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.cpp
@@ -1220,6 +1220,8 @@
     for (size_t cnt = 0; cnt < maxChars && srcLen; cnt++) {
         size_t    rc = iconvFrom(startSrc, &srcLen, &orgTarget, uChSize());
         if (rc == (size_t)-1) {
+            if (errno == EINVAL && cnt > 0)
+                break;
             if (errno != E2BIG || prevSrcLen == srcLen) {
                 if (wBufPtr)
                     getMemoryManager()->deallocate(wBufPtr);//delete [] wBufPtr;