Bug 961444 - Variant decoding/conversion incorrect for at least bin8, int8, uint8 data types
Variant decoding/conversion incorrect for at least bin8, int8, uint8 data types
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise MRG
Classification: Red Hat
Component: qpid-cpp (Show other bugs)
2.3
Unspecified Unspecified
high Severity medium
: 2.3.3
: ---
Assigned To: Mike Cressman
Leonid Zhaldybin
:
Depends On: 961014
Blocks:
  Show dependency treegraph
 
Reported: 2013-05-09 12:02 EDT by Mike Cressman
Modified: 2014-11-09 17:39 EST (History)
6 users (show)

See Also:
Fixed In Version: qpid-cpp-0.18-15
Doc Type: Bug Fix
Doc Text:
Cause: The code for decoding AMQP 0-10 maps was using the wrong typecodes for signed and unsigned single byte width values. Consequence: Properties set as e.g. uint8_t would be decoded as an int8_t. Fix: The codes used for those data types has been corrected. Result: The decoded data types match those that were originally encoded.
Story Points: ---
Clone Of: 961014
Environment:
Last Closed: 2013-07-16 07:37:26 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Apache JIRA QPID-4820 None None None Never

  None (edit)
Description Mike Cressman 2013-05-09 12:02:20 EDT
+++ This bug was initially created as a clone of Bug #961014 +++

Copied from https://issues.apache.org/jira/browse/QPID-4820:

In the toVariant method in Codecs.cpp (https://github.com/apache/qpid/blob/trunk/qpid/cpp/src/qpid/amqp_0_10/Codecs.cpp#L99), the case statements for bin8, int8, and uint8 are incorrect.

bin8 should be 0x00 (it's currently 0x01)
int8 should be 0x01 (it's currently 0x02)
uint8 should be 0x02 (it's currently 0x03)

If you send a message like

message.getProperties["key"] = boost::uint8_t(255)

When you receive it, the value of that property comes out as -1, as the client incorrectly decodes the uint8 as an int8.

It might be worth reviewing the entire switch block to see if anything else needs adjusting.

--- Additional comment from Gordon Sim on 2013-05-08 11:40:16 EDT ---

Fixed upstream: http://svn.apache.org/viewvc?view=revision&revision=1480327
Comment 2 Leonid Zhaldybin 2013-05-23 06:22:08 EDT
Tested on RHEL5 and RHEL6, both i386 and x86_64. This issue has been fixed.

Packages used for testing:

qpid-cpp-client-0.18-15
qpid-cpp-client-devel-0.18-15
qpid-cpp-client-devel-docs-0.18-15
qpid-cpp-client-ssl-0.18-15
qpid-cpp-server-0.18-15
qpid-cpp-server-devel-0.18-15
qpid-cpp-server-ssl-0.18-15
qpid-cpp-server-store-0.18-15
qpid-cpp-server-xml-0.18-15
qpid-java-client-0.18-8
qpid-java-common-0.18-8
qpid-java-example-0.18-8
qpid-jca-0.18-8
qpid-jca-xarecovery-0.18-8

Note You need to log in before you can comment on or make changes to this bug.