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

Pass read-only flag to peeked slice in IO::Memory #10891

Merged
merged 1 commit into from
Jul 5, 2021
Merged

Pass read-only flag to peeked slice in IO::Memory #10891

merged 1 commit into from
Jul 5, 2021

Conversation

z64
Copy link
Contributor

@z64 z64 commented Jul 3, 2021

Prevents potential segfaults or other unintended states caused by ignoring the read-protection of the inherited buffer in IO::Memory.

Reported by a user in Discord who was trying to re-use the buffer prior to pos as they were processing data from peek/read. Unsure how common this kind of scenario is (specifically with ROM), but this seems like a sensible change for safety's sake.

Unsure of the best way to organize the spec. Please feel free to move or change it.

Prevents potential segfaults or other unintended states caused by
ignoring the read-protection of the inherited buffer in IO::Memory.
Copy link
Member

@asterite asterite left a comment

Choose a reason for hiding this comment

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

Makes total sense, thank you!

@straight-shoota straight-shoota added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:stdlib:collection labels Jul 3, 2021
@straight-shoota straight-shoota added this to the 1.1.0 milestone Jul 3, 2021
@straight-shoota straight-shoota merged commit 234eb09 into crystal-lang:master Jul 5, 2021
@straight-shoota
Copy link
Member

Thank you @z64

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.

3 participants