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 incorrect overflow in UInt64.from_yaml #13829

Merged

Conversation

HertzDevil
Copy link
Contributor

UInt64.from_yaml raises YAML::ParseException if the value is larger than Int64::MAX. This is because the method relies on YAML::Schema::Core.parse_scalar which, being primarily intended for YAML::Any's use, supports only Int64. This PR fixes that by skipping parse_scalar altogether.

Note that OverflowError is never raised, since string-to-integer conversions raise ArgumentError instead, and there are no more integer-to-integer conversions.

@straight-shoota straight-shoota added this to the 1.10.0 milestone Sep 24, 2023
@straight-shoota straight-shoota merged commit 0520944 into crystal-lang:master Sep 25, 2023
51 of 53 checks passed
@HertzDevil HertzDevil deleted the bug/yaml-uint64-overflow branch September 25, 2023 12:29
Blacksmoke16 pushed a commit to Blacksmoke16/crystal that referenced this pull request Dec 11, 2023
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants