Bug 961014

Summary: Variant decoding/conversion incorrect for at least bin8, int8, uint8 data types
Product: Red Hat Enterprise MRG Reporter: Andy Goldstein <agoldste>
Component: qpid-cppAssignee: Gordon Sim <gsim>
Status: CLOSED ERRATA QA Contact: Leonid Zhaldybin <lzhaldyb>
Severity: medium Docs Contact:
Priority: high    
Version: DevelopmentCC: esammons, gsim, jross, lzhaldyb, mcressma
Target Milestone: 3.0   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qpid-cpp-0.22-4.el6, qpid-cpp-0.22-4.el5 Doc Type: Bug Fix
Doc Text:
It was discovered the code that decoded AMQP 0-10 maps was using the wrong typecodes for signed and unsigned single byte width values. Properties set as `uint8_t` would be decoded as an `int8_t`. The fix changes the codes used for those data types to the correct codes. Decoded data types now match the originally-encoded data types.
Story Points: ---
Clone Of:
: 961444 (view as bug list) Environment:
Last Closed: 2014-09-24 15:08:01 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 961444    

Description Andy Goldstein 2013-05-08 14:17:48 UTC
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.

Comment 1 Gordon Sim 2013-05-08 15:40:16 UTC
Fixed upstream: http://svn.apache.org/viewvc?view=revision&revision=1480327

Comment 2 Leonid Zhaldybin 2013-06-19 14:19:10 UTC
Tested on both RHEL5.9 and RHEL6.4 (i386 and x86_64). This issue has been fixed.

Packages used for testing:

RHEL6.4:
python-qpid-0.22-3.el6
python-qpid-qmf-0.22-3.el6
qpid-cpp-client-0.22-4.el6
qpid-cpp-client-devel-0.22-4.el6
qpid-cpp-client-devel-docs-0.22-4.el6
qpid-cpp-server-0.22-4.el6
qpid-cpp-server-devel-0.22-4.el6
qpid-cpp-server-store-0.22-4.el6
qpid-cpp-server-xml-0.22-4.el6
qpid-java-client-0.22-3.el6
qpid-java-common-0.22-3.el6
qpid-java-example-0.22-3.el6
qpid-jca-0.18-8.el6
qpid-jca-xarecovery-0.18-8.el6
qpid-proton-c-0.4-2.2.el6
qpid-qmf-0.22-3.el6
qpid-tools-0.22-3.el6

RHEL5.9:
python-qpid-0.22-2.el5
python-qpid-qmf-0.22-2.el5
qpid-cpp-client-0.22-4.el5
qpid-cpp-client-devel-0.22-4.el5
qpid-cpp-client-devel-docs-0.22-4.el5
qpid-cpp-client-ssl-0.22-4.el5
qpid-cpp-server-0.22-4.el5
qpid-cpp-server-devel-0.22-4.el5
qpid-cpp-server-ha-0.22-4.el5
qpid-cpp-server-ssl-0.22-4.el5
qpid-cpp-server-store-0.22-4.el5
qpid-cpp-server-xml-0.22-4.el5
qpid-java-client-0.22-2.el5
qpid-java-common-0.22-2.el5
qpid-java-example-0.22-2.el5
qpid-jca-0.18-8.el5
qpid-jca-xarecovery-0.18-8.el5
qpid-proton-c-0.4-2.2.el5
qpid-qmf-0.22-2.el5
qpid-qmf-devel-0.22-2.el5
qpid-tools-0.22-2.el5

Comment 4 errata-xmlrpc 2014-09-24 15:08:01 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHEA-2014-1296.html