Storable should not assume that sizeof(mg_len) is 4.
authorNicholas Clark <nick@ccl4.org>
Wed, 31 Jul 2013 10:43:51 +0000 (12:43 +0200)
committerNicholas Clark <nick@ccl4.org>
Mon, 5 Aug 2013 12:54:19 +0000 (14:54 +0200)
commitd2af8e81df47b54a6c2fffeb9458370d03498c4e
tree1c9a8daf079ad241d9e4e8484e55bd425992e283
parent304dad4c4ab670eacdc2f5034695fdca0e71da88
Storable should not assume that sizeof(mg_len) is 4.

Commit 6174b39a88cd4874 changed mg_len from I32 to SSize_t. sizeof(I32) is 4
everywhere (except certain Crays, for which Storable has work-around code).
In the version object serialisation code, Storable was passing mg->len
directly to the macro WLEN(), and and it turns out that some paths through
this macro is relying on the assumption that the value passed in is 32 bits.
This is now invalid on on 64 bit systems, but only triggered an error with
the existing tests on big endian systems.

The easiest fix is to assign the value to a temporary variable of the
correct size, and process that. However, a lot of the code makes a lot of
unwarranted assumptions about sizeof(int), and ideally should be audited and
rewritten to use more appropriate types.
dist/Storable/Storable.xs