-
Notifications
You must be signed in to change notification settings - Fork 909
Closed
Description
Pretty critical thing. High probability of int64 value being broken.
Reproduced with Ubuntu's package 0.5.7-2.
Here is the test snippet:
int64_t test_i64 = 0xFFF7FFFFFFFFFFFFLL;
msgpack_sbuffer buf;
msgpack_sbuffer_init(&buf);
msgpack_packer * pk = msgpack_packer_new(&buf, msgpack_sbuffer_write);
msgpack_pack_array(pk, 2);
msgpack_pack_int32(pk, 0);
msgpack_pack_int64(pk, test_i64);
msgpack_packer_free(pk);
uint32_t upk_pos = 0;
msgpack_unpacked msg;
msgpack_unpacked_init(&msg);
if(msgpack_unpack_next(&msg, buf.data, buf.size, &upk_pos))
assert(msg.data.via.array.ptr[1].via.i64 == test_i64);
msgpack_sbuffer_destroy(&buf);
0xFFF7FFFFFFFFFFFFLL is a specific value I found to be broken after unpacking. 53th bit will always be set to 1 for some reason. That's the cause of the problem. Also I found that int64 must be packed inside of an array to reproduce the bug. Everything said above is truth for uint64 as well.
Metadata
Metadata
Assignees
Labels
No labels