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

Fix parsing uint64 fields with values >= 2^32 #39

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Fix parsing uint64 fields with values >= 2^32 #39

wants to merge 1 commit into from

Conversation

gabmontes
Copy link

The amount field in an Output message is 64 bits long and is represented
in the JavaScript side using a Long object. When its value is get
through the PaymentProtocol interface, it is parsed using the toInt().
toInt() interprets the Long object as 32 bit so amounts larger than 2^32
will be incorrectly parsed i.e. when an output has an amount larger than
42.9 BTC.

The same issue applies to the PaymentDetails/PaymentRequest messages as
time and expires fields are uint64 too. If time or expires are larger
than 2^32, get operations on those fields will return incorrect values.

The amount field in an Output message is 64 bits long and is represented
in the JavaScript side using a Long object. When its value is get
through the PaymentProtocol interface, it is parsed using the toInt().
toInt() interprets the Long object as 32 bit so amounts larger than 2^32
will be incorrectly parsed i.e. when an output has an amount larger than
42.9 BTC.

The same issue applies to the PaymentDetails/PaymentRequest messages as
time and expires fields are uint64 too. If time or expires are larger
than 2^32, get operations on those fields will return incorrect values.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant