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 Char::Reader#each bounds check after block #13817

Merged

Conversation

straight-shoota
Copy link
Member

Resolves #13816

@straight-shoota straight-shoota self-assigned this Sep 19, 2023
@straight-shoota straight-shoota changed the title Fix Char::Reader#each bounds check with nested loop in block Fix Char::Reader#each bounds check after block Sep 19, 2023
HertzDevil
HertzDevil previously approved these changes Sep 19, 2023
@HertzDevil HertzDevil dismissed their stale review September 19, 2023 19:52

Specs are failing

@straight-shoota
Copy link
Member Author

straight-shoota commented Sep 19, 2023

Oh that's a nice one. Specs are failing everywhere in stdlib but char/reader_spec is all green 🙈

EDIT: Yeah that won't fail if there's an extra null character 🤷

sum = 0
reader.each do |char|
sum += char.ord
end.should be_nil
sum.should eq(294)

@straight-shoota straight-shoota added this to the 1.10.0 milestone Sep 20, 2023
@straight-shoota straight-shoota merged commit 6473d3d into crystal-lang:master Sep 23, 2023
53 checks passed
@straight-shoota straight-shoota deleted the fix/char_reader-each branch September 23, 2023 07:22
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.

Char::Reader#each can go out of bounds
3 participants