You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Kirby Zhou <ki...@gmail.com> on 2010/07/23 14:11:12 UTC
There seems a bug inside ICUTranscoder::transcodeFrom and another in IconvGNUTranscoder::transcodeFrom
ICUTranscoder::transcodeFrom
495 UErrorCode err = U_ZERO_ERROR;
496 ucnv_toUnicode
497 (
498 fConverter
499 , &startTarget
500 , startTarget + maxChars
501 , (const char**)&startSrc
502 , (const char*)endSrc
503 , (fFixed ? 0 : (int32_t*)fSrcOffsets)
504 , false
505 , &err
506 );
There seems need a mute to protect fConverter.
ICULCPTranscoder::calcRequiredSize called ' XMLMutexLock
lockConverter(&fMutex); ' to do it.
IconvGNUTranscoder::transcodeFrom
1027 for (size_t cnt = 0; cnt < maxChars && srcLen; cnt++) {
1028 size_t rc = iconvFrom(startSrc, &srcLen, &orgTarget,
uChSize());
1029 if (rc == (size_t)-1) {
1030 if (errno != E2BIG || prevSrcLen == srcLen) {
1031 ThrowXMLwithMemMgr(TranscodingException,
XMLExcepts::Trans_BadSrcSeq, getMemoryManager());
1032 }
1033 }
1034 charSizes[cnt] = prevSrcLen - srcLen;
1035 prevSrcLen = srcLen;
It do not deal with errno==EINVAL, which will happen when it is called by
XMLReader::refreshCharBuffer with an incomplete MBCS character.
I mean, one half is in buffer, and the other half is left on disk.
Regards
Kirby Zhou
---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org