Skip to content

Conversation

@vtjnash
Copy link
Member

@vtjnash vtjnash commented Feb 18, 2021

fix #39717

@vtjnash vtjnash added the backport 1.6 Change should be backported to release-1.6 label Feb 18, 2021
size_t len = jl_array_len(a);
if (len == 0) {
// this may seem like purely an optimization (which it also is), but it
// also ensures that calling `String(a)` doesn't corrupt a previous
Copy link
Member

Choose a reason for hiding this comment

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

Just curious, but why/how exactly does a previous string get corrupted w/o this? The segfault seems to be gc-related; something about the original string now being "shared" between two strings?

Copy link
Member Author

Choose a reason for hiding this comment

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

We truncate the array here (so that future uses will get a fresh data object), but that ends up truncating the string later, if it is still the data pointer and we call this immediately. See the added tests.

@JeffBezanson JeffBezanson added the bugfix This change fixes an existing bug label Feb 18, 2021
@vtjnash vtjnash merged commit 0926ed8 into master Feb 18, 2021
@vtjnash vtjnash deleted the jn/39717 branch February 18, 2021 18:30
@KristofferC KristofferC mentioned this pull request Feb 22, 2021
52 tasks
KristofferC pushed a commit that referenced this pull request Feb 22, 2021
@KristofferC KristofferC removed the backport 1.6 Change should be backported to release-1.6 label Mar 14, 2021
staticfloat pushed a commit that referenced this pull request Dec 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix This change fixes an existing bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Segfault in regex matching

5 participants