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

Segfault with String.trim_in_place and String.append #1996

Closed
SeanTAllen opened this issue Jul 1, 2017 · 0 comments
Closed

Segfault with String.trim_in_place and String.append #1996

SeanTAllen opened this issue Jul 1, 2017 · 0 comments
Assignees
Labels
triggers release Major issue that when fixed, results in an "emergency" release

Comments

@SeanTAllen
Copy link
Member

See:

https://pony.groups.io/g/user/topic/segv_by_string_trim_in_place/5435457?p=,,,20,0,0,0::recentpostdate%2Fsticky,,,20,2,0,5435457

@SeanTAllen SeanTAllen added bug: 4 - in progress triggers release Major issue that when fixed, results in an "emergency" release labels Jul 1, 2017
@SeanTAllen SeanTAllen self-assigned this Jul 1, 2017
SeanTAllen added a commit that referenced this issue Jul 1, 2017
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
This was referenced Jul 1, 2017
@jemc jemc closed this as completed in #1997 Jul 1, 2017
jemc pushed a commit that referenced this issue Jul 1, 2017
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triggers release Major issue that when fixed, results in an "emergency" release
Projects
None yet
Development

No branches or pull requests

1 participant