[
https://issues.apache.org/jira/browse/THRIFT-2026?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15931498#comment-15931498
]
ASF GitHub Bot commented on THRIFT-2026:
----------------------------------------
Github user jeking3 commented on a diff in the pull request:
https://github.com/apache/thrift/pull/1214#discussion_r106794619
--- Diff: lib/c_glib/src/thrift/c_glib/protocol/thrift_compact_protocol.c
---
@@ -120,7 +120,11 @@ thrift_bitwise_cast_gdouble (const guint64 v)
static guint64
i64_to_zigzag (const gint64 l)
{
- return (l << 1) ^ (l >> 63);
--- End diff --
Sounds to me like a negative input is not allowed; can we change the input
type to unsigned then, or throw an exception when it is negative? If you look
inside commit 7edc8faefd391ce11eca3023a35cc54bcb2eb1af I added code in the cpp
library (and compiler, following the "throw a string" ugliness) to throw on
various conditions like this. Let's make it so these undefined cases cause an
exception rather than trying to clip them.
> 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)