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 "Alberto Massari (Resolved) (JIRA)" <xe...@xml.apache.org> on 2011/12/27 12:10:30 UTC

[jira] [Resolved] (XERCESC-1224) IconvGNUTranscoder::transcodeFrom() is incomplete

     [ https://issues.apache.org/jira/browse/XERCESC-1224?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alberto Massari resolved XERCESC-1224.
--------------------------------------

    Resolution: Duplicate

Fixed as part of XERCESC-1936
                
> IconvGNUTranscoder::transcodeFrom() is incomplete
> -------------------------------------------------
>
>                 Key: XERCESC-1224
>                 URL: https://issues.apache.org/jira/browse/XERCESC-1224
>             Project: Xerces-C++
>          Issue Type: Bug
>          Components: Utilities
>    Affects Versions: 2.5.0
>         Environment: Linux
>            Reporter: Felix Li
>
> the snatch in this function:
> ...
> for (size_t cnt = 0; cnt < maxChars && srcLen; cnt++) {
>     size_t rc = inconvFrom(startSrc, &srcLen, &orgTarget, uChSize());
>     if (rc == (size_t)-1) {
>         if(errno != E2BIG || prevSrcLen == srcLen) {
>             if (wBufPtr)
>                 getMemoryManager()->deallocate(wBufPtr);
>             ThrowXMLwithMemMgr(TranscodingException, XMLExcepts::Trans_BadSrcSeq, getMemoryManager());
>         }
>     }
>     ...
> }
> ...
> When an incomplete multibyte sequence is encountered in the input, and the input byte sequence terminates after it, "(size_t)-1" is also returned, but errno is set to EINVAL.
> This is not an error, no exception should be created.
> So, I have changed the code as follows, and it worked well.
> ...
> for (size_t cnt = 0; cnt < maxChars && srcLen; cnt++) {
>     ...
>     if (rc == (size_t)-1) {
>         if (errno == EINVAL) { //incomplete multibyte sequence
>             break;
>         }
>         if (errno != E2BIG || prevSrcLen == srcLen) {
>         ...
>         }
>     }
>     ...
> }
> ...

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org