You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Jim Apple (JIRA)" <ji...@apache.org> on 2017/03/18 06:45:41 UTC

[jira] [Commented] (THRIFT-2026) Fix TCompactProtocol 64 bit builds

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

Jim Apple commented on THRIFT-2026:
-----------------------------------

There is still undefined behavior in TCompactProtocol. For instance, https://github.com/apache/thrift/blob/ddc53c32486cc23dfa63ed4e5abb19923b8d13e6/lib/cpp/src/thrift/protocol/TCompactProtocol.tcc#L390 includes a left shift of a signed value. When that value is negatie, this results in undefined behavior. In this draft copy of the C++14 standard, http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/n4582.pdf, that's 5.8 Shift operators \[expr.shift\], paragraph 2.

I would re-open this issue, but I do not appear to have the auths to do so.

> Fix TCompactProtocol 64 bit builds
> ----------------------------------
>
>                 Key: THRIFT-2026
>                 URL: https://issues.apache.org/jira/browse/THRIFT-2026
>             Project: Thrift
>          Issue Type: Bug
>          Components: C++ - Library
>    Affects Versions: 0.9
>         Environment: Mac 64, Win 64, Linux 64
>            Reporter: Ben Craig
>            Assignee: Ben Craig
>             Fix For: 0.9.2
>
>         Attachments: compact_int_stuff.patch
>
>
> TCompactProtocol has several places where it truncates a size_t to a 32-bit value.
> TCompactProtocol also does bitwise operations on signed values, which has undefined behavior.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)