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

Array: fix range assignment index out of bounds #8347

Merged
merged 2 commits into from
Oct 18, 2019

Conversation

asterite
Copy link
Member

@asterite asterite commented Oct 18, 2019

Fixes #8341

The main fix is that the index that we pass can be the size of the Array, because it starts a range from there and it should work if count is zero (or a greater value too). The usual check_index_out_of_bounds checks for index < size, in this case we need index <= size.

@asterite asterite added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:stdlib:collection labels Oct 18, 2019
Copy link
Member

@sdogruyol sdogruyol left a comment

Choose a reason for hiding this comment

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

🚀

@asterite asterite added this to the 0.32.0 milestone Oct 18, 2019
@asterite asterite merged commit e0b7dcb into crystal-lang:master Oct 18, 2019
@asterite asterite deleted the bug/array-range-empty branch October 18, 2019 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:stdlib:collection
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Assignment to unbounded (or empty) range of empty array should not fail
3 participants