You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Ben Craig (JIRA)" <ji...@apache.org> on 2013/08/28 23:45:52 UTC

[jira] [Commented] (THRIFT-1455) TBinaryProtocolT::writeString casts from size_t to uint32_t, which is not safe on 64-bit platforms

    [ https://issues.apache.org/jira/browse/THRIFT-1455?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13752886#comment-13752886 ] 

Ben Craig commented on THRIFT-1455:
-----------------------------------

I believe this was fixed as part of THRIFT-1690.  A range check is performed first, and then a static_cast.
                
> TBinaryProtocolT<Transport_>::writeString casts from size_t to uint32_t, which is not safe on 64-bit platforms
> --------------------------------------------------------------------------------------------------------------
>
>                 Key: THRIFT-1455
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1455
>             Project: Thrift
>          Issue Type: Bug
>          Components: C++ - Library
>         Environment: gcc 4.4.4, 64 bit Linux (with -Werror and -Wconversion compile flags)
>            Reporter: Bob Callaway
>            Priority: Minor
>
> The first line in this method sets the size based on the string length, which is of size_t type. On a 64-bit platform, the cast from a 64 bit unsigned integer to a 32 bit unsigned integer can result in incomplete data being written. 
> With my compiler flags (-Werror and -Wconversion), I can't compile my code that includes the client library headers. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira