-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Syntax] Fix use-after-free in SyntaxSerialization #10374
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
Conversation
@swift-ci please ASAN test |
4b885a7
to
7302936
Compare
@swift-ci please ASAN test |
Doesn't this mean the copy of the string leaks? Either that or the copy is destroyed at the end of the statement and asan will fail too? |
Yep. I think the main issue is that this string owned by the A more permanent fix would be to ensure the |
@swift-ci please ASAN test |
Passed ASAN locally. @swift-ci please ASAN test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to squash the two commits before merging, so that the copying isn't done and then immediately undone.
c5e64ee
to
6ad0977
Compare
I squashed those changes 👍 @swift-ci please smoke test and merge |
@swift-ci please smoke test and merge |
Uh... @shahmishal:
|
This was after building Foundation. |
In the meantime, what's one more test? @swift-ci please smoke test and merge |
The ASAN build caught a use-after-free because the
StringRef
passed into the JSON output forTriviaPiece
was destroyed before the outputting happened.Instead, explicitly copy theInstead, ensure the string outlives the raw syntax tree by moving theOwnedString
first.CompilerInstance
out ofgetSyntaxTree
.