Skip to content
This repository has been archived by the owner on Feb 22, 2019. It is now read-only.

BinaryParser.fromLong loops and runs out of memory on negative numbers #1

Open
calvinfo opened this issue Jun 7, 2012 · 2 comments

Comments

@calvinfo
Copy link

calvinfo commented Jun 7, 2012

Seems to be the way it is bit shifting in encodeInt after adjusting data to be represented as a positive number.

To reproduce:

thrift.BinaryParser.BinaryParser.fromLong(-1);

FATAL ERROR: CALL_AND_RETRY_0 Allocation failed - process out of memory.
@calvinfo
Copy link
Author

calvinfo commented Jun 7, 2012

Ah figured out more of the problem. Javascript doesn't have adequate precision for numbers that large, try Math.pow(2, 64) - 1 === Math.pow(2, 64) from node and you'll see what I mean.

The array is then initialized to 9 bytes instead of 8, resulting in an infinite loop in the encodeInt function.

@devdazed
Copy link

devdazed commented Jun 7, 2012

Interesting, I will have a look into this

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants