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 IO::Delimited reading into limited slice with peek #14772

Conversation

straight-shoota
Copy link
Member

@straight-shoota straight-shoota commented Jul 2, 2024

When copying into a slice we cannot assume it has unlimited capacity. In this case we need to restrict next_index || @active_delimiter_buffer.size to slice.size in order to avoid writing more than would fit.

I checked related code in this method but did not find a similar isssue elsewhere.

Resolves #14751

@straight-shoota straight-shoota added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:stdlib:files labels Jul 2, 2024
@straight-shoota straight-shoota self-assigned this Jul 2, 2024
@straight-shoota straight-shoota added this to the 1.13.0 milestone Jul 2, 2024
@straight-shoota straight-shoota merged commit be46ba2 into crystal-lang:master Jul 3, 2024
61 checks passed
@straight-shoota straight-shoota deleted the fix/io-delimited-peek-limit branch July 3, 2024 11:34
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:files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Index out of bounds when uploading files through iOS
2 participants