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 "George D. Houpis (JIRA)" <xe...@xml.apache.org> on 2006/10/09 17:07:20 UTC

[jira] Commented: (XERCESC-1640) XSerializeEngine::getBufCur() performing potential downcast from 64-bit pointers to 32-bit integers.

    [ http://issues.apache.org/jira/browse/XERCESC-1640?page=comments#action_12440901 ] 
            
George D. Houpis commented on XERCESC-1640:
-------------------------------------------

Alternatively, this can be preserved with a static cast:
unsigned long XSerializeEngine::getBufCur() const
{
    return static_cast<unsigned long>(fBufCur-fBufStart);
}


> XSerializeEngine::getBufCur() performing potential downcast from 64-bit pointers to 32-bit integers.
> ----------------------------------------------------------------------------------------------------
>
>                 Key: XERCESC-1640
>                 URL: http://issues.apache.org/jira/browse/XERCESC-1640
>             Project: Xerces-C++
>          Issue Type: Bug
>    Affects Versions: 2.7.0
>         Environment: AMD64, WinXP,  Win32 - MSDEV 2005 = MSVC8.0
>            Reporter: George D. Houpis
>
> Under the inline code for XSerializeEngine.hpp, one method detecting the current buffer is returning a 32-bit size to a 64-bit pointer arithmatic.  The inlined method getBufCur needs to return "XMLByte *" instead of "unsigned long".  This situation may not arise from gcc on AMD64 because that platform tends to treat 'unsigned long' as 64-bit integers.  This is provided as a major issue to prevent any unintended consequences even though the likelihood of a buffer exceeding 2GB is nearly nil.
> This approach will prevent unintended downcasts:
> inline 
> XMLByte * XSerializeEngine::getBufCur() const
> {
>     return fBufCur-fBufStart;
> }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.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