Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unpacker#read_array_header and Unpacker#read_map_header return a wrong size. #127

Open
x-nagasawa opened this issue Nov 24, 2016 · 0 comments
Open

Comments

@x-nagasawa
Copy link

@x-nagasawa x-nagasawa commented Nov 24, 2016

In windows environment with msgpack-1.0.2-x86-mingw32, Unpacker#read_array_header for array16 and Unpacker#read_map_header for map16 return a wrong size.

A code to reproduce is following.

require 'msgpack'

p MessagePack::VERSION

unpacker = MessagePack::Unpacker.new()
# feed array 16 including one element.
unpacker.feed("\xdc\x00\x01\x01")
# expect "1" but returns "10001"
puts 'read_array_header : ' + unpacker.read_array_header.to_s(16)
unpacker.read.to_s
# feed map 16 including one element.
unpacker.feed("\xde\x00\x02\x01\x02\x03\x04")
# expect "2" but returns "20002"
puts 'read_map_header : ' + unpacker.read_map_header.to_s(16)

In Windows7(64bit) with ruby 2.2.1p85 (2015-02-26 revision 49769) [i386-mingw32], the code returns wrong size as below.

"1.0.2"
read_array_header : 10001
read_map_header : 20002

The result of read_array_header is excepted "1" but it returns "0x010001".
The result of read_map_header is excepted "2" but it returns "0x020002".

I guess there are some type-cast or bit-mask miss.

In Linux(CentOS7) with ruby 2.0.0p598 [x86_64-linux], it works correctly.

"1.0.2"
read_array_header : 1
read_map_header : 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.