Author: amassari
Date: Tue Dec 27 10:14:07 2011
New Revision: 1224887
URL: http://svn.apache.org/viewvc?rev=1224887&view=rev
Log:
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)
Modified:
xerces/c/branches/xerces-2/src/xercesc/util/Transcoders/ICU/ICUTransService.cpp
xerces/c/branches/xerces-2/src/xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.cpp
Modified:
xerces/c/branches/xerces-2/src/xercesc/util/Transcoders/ICU/ICUTransService.cpp
URL:
http://svn.apache.org/viewvc/xerces/c/branches/xerces-2/src/xercesc/util/Transcoders/ICU/ICUTransService.cpp?rev=1224887&r1=1224886&r2=1224887&view=diff
==============================================================================
---
xerces/c/branches/xerces-2/src/xercesc/util/Transcoders/ICU/ICUTransService.cpp
(original)
+++
xerces/c/branches/xerces-2/src/xercesc/util/Transcoders/ICU/ICUTransService.cpp
Tue Dec 27 10:14:07 2011
@@ -677,7 +677,7 @@ ICUTranscoder::transcodeTo( const XMLC
);
// 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;
Modified:
xerces/c/branches/xerces-2/src/xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.cpp
URL:
http://svn.apache.org/viewvc/xerces/c/branches/xerces-2/src/xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.cpp?rev=1224887&r1=1224886&r2=1224887&view=diff
==============================================================================
---
xerces/c/branches/xerces-2/src/xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.cpp
(original)
+++
xerces/c/branches/xerces-2/src/xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.cpp
Tue Dec 27 10:14:07 2011
@@ -1220,6 +1220,8 @@ unsigned int IconvGNUTranscoder::tran
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;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]