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

fix: amend incorrect int bound check #65

Merged
merged 10 commits into from
Nov 24, 2023

Conversation

gabrielmer
Copy link
Contributor

int64 numbers range from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.

When checking if an int64 is in a valid range, we have to check whether its absolute value is smaller or equal than 9,223,372,036,854,775,808 for negative numbers, and smaller or equal than 9,223,372,036,854,775,807 for positive numbers.

Without this fix, 9,223,372,036,854,775,808 is taken as a valid int64 number which is not.

Copy link

@Ivansete-status Ivansete-status left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for it! 💯

@etan-status
Copy link
Contributor

I think that a test for the edge case being addressed here would be great.

@gabrielmer
Copy link
Contributor Author

I think that a test for the edge case being addressed here would be great.

Great idea! Just added a couple tests and fixed some bugs I had missed :)

json_serialization/reader.nim Outdated Show resolved Hide resolved
json_serialization/reader.nim Outdated Show resolved Hide resolved
json_serialization/reader.nim Outdated Show resolved Hide resolved
Copy link

@Ivansete-status Ivansete-status left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks!
Just added a persistent question xD

json_serialization/reader.nim Outdated Show resolved Hide resolved
@gabrielmer gabrielmer merged commit 230e226 into status-im:master Nov 24, 2023
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants