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 segfault in String.trim_in_place #1997

Merged
merged 1 commit into from
Jul 1, 2017
Merged

Fix segfault in String.trim_in_place #1997

merged 1 commit into from
Jul 1, 2017

Conversation

SeanTAllen
Copy link
Member

String.trim_in_place wasn't written to work correctly if you were
to trim the string down to nothing and then append a size less than the
"alloc" value that is left. This combination could result in incorrect
handling for strings that end up with a size of 0.

This is because, a new pointer was created, but we retained incorrect
alloc info. This wouldn't cause an error so long as when you used the
string for something like an append, reserve allocated new memory.
However, if the appended value was less than the perceived alloc size,
no additional memory would be added and kaboom.

Closes #1996

String.trim_in_place wasn't written to work correctly if you were
to trim the string down to nothing and then append a size less than the
"alloc" value that is left. This combination could result in incorrect
handling for strings that end up with a size of 0.

This is because, a new pointer was created, but we retained incorrect
alloc info. This wouldn't cause an error so long as when you used the
string for something like an append, reserve allocated new memory.
However, if the appended value was less than the perceived alloc size,
no additional memory would be added and kaboom.

Closes #1996
@SeanTAllen SeanTAllen added changelog - fixed Automatically add "Fixed" CHANGELOG entry on merge triggers release Major issue that when fixed, results in an "emergency" release labels Jul 1, 2017
@SeanTAllen SeanTAllen requested a review from jemc July 1, 2017 19:35
@jemc jemc merged commit 381b281 into master Jul 1, 2017
ponylang-main added a commit that referenced this pull request Jul 1, 2017
@jemc jemc deleted the issue-1996 branch July 1, 2017 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog - fixed Automatically add "Fixed" CHANGELOG entry on merge triggers release Major issue that when fixed, results in an "emergency" release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants