commit | 9829c35f69850c4ce5b047d67bdf05c876c6f87c | [log] [tgz] |
---|---|---|
author | Alberto Massari <amassari@apache.org> | Tue Dec 27 10:14:07 2011 +0000 |
committer | Alberto Massari <amassari@apache.org> | Tue Dec 27 10:14:07 2011 +0000 |
tree | faa2e2a3cecc24752be1a423a2a26d440b23d7c1 | |
parent | ba08790b2954006cb2c8d1c867c6129a4f8e57c2 [diff] |
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;