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

Integer marshalling is inconsistent between architectures #5793

Closed
vicuna opened this Issue Oct 17, 2012 · 1 comment

Comments

Projects
None yet
1 participant
@vicuna
Copy link
Collaborator

vicuna commented Oct 17, 2012

Original bug ID: 5793
Reporter: ppedrot
Assigned to: @xclerc
Status: closed (set by @xavierleroy on 2015-12-11T18:18:36Z)
Resolution: fixed
Priority: normal
Severity: minor
Fixed in version: 4.00.2+dev
Category: standard library
Related to: #5977

Bug description

When marshalling integers between 32 and 64-bits architectures, integers which are inbetween 2^31 and 2^32 - 1 are treated in a inconsistent way.

In particular, 64-bit architectures marshal them as 32-bit integers, while 32-bit architectures unmarshal them as if they were only 31-bit long, thus resulting in an silent overflow.

Steps to reproduce

On a 64-bit arch, retrieve the string produced by the following command:

Marshal.to_string (1 lsl 30) []

Then on a 32-bit arch, unmarshal the previous string. This results in an overflow.

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Jan 16, 2013

Comment author: @xclerc

Fixed in both '4.00' (revision 13242) and trunk (revision 13241) branches.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.