You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
using ParseBase58 as an example, values should round-trip properly back to their original value, or error.
ok:="npL6MjP8Qfc"//0x7fffffffffffffffbad1:="npL6MjP8Qfd"//0x7fffffffffffffff + 1 // overflows int64 and becomes negativebad2:="JPwcyDCgEuq"//0xffffffffffffffff + 1 // overflows uint64 and wraps back to 1
in the case of bad1 it parses "successfully" and returns a negative value, which later panics when Base58() cannot convert it back to a string (it doesn't handle negative cases). It should error on parsing, or negatives should be supported throughout (or the base type should be uint64).
in the case of bad2 it parses "successfully" and returns a value of 1, which base58() does not encode back to the original number, obviously. it should probably error because the original number is not valid.
These issues can come up when accepting requests with bad IDs from clients, and they should not be accepted as valid ids.
The text was updated successfully, but these errors were encountered:
ssoroka
changed the title
parsing fails for negative numbers
parsing doesn't consider negative numbers
Feb 7, 2022
using
ParseBase58
as an example, values should round-trip properly back to their original value, or error.These issues can come up when accepting requests with bad IDs from clients, and they should not be accepted as valid ids.
The text was updated successfully, but these errors were encountered: