Skip to content

[llvm-cgdata] Fix Dangling StringRefs #143210

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

Merged

Conversation

NuriAmari
Copy link
Contributor

OutputFilename and Filename are assigned to StringRefs in parseArgs, but after parseArgs returns the InputArgsList that once owned the underlying strings is popped off the stack, and the StringRefs can be left pointing at garbage.

Switch to std::string to own the strings.

`OutputFilename` and `Filename` are assigned to StringRefs in
`parseArgs`, but after `parseArgs` returns the `InputArgsList` that once
owned the underlying strings is popped off the stack, and the StringRefs
can be left pointing at garbage.

Switch to std::string to own the strings.
@NuriAmari NuriAmari requested a review from kyulee-com June 6, 2025 21:52
Copy link
Contributor

@kyulee-com kyulee-com left a comment

Choose a reason for hiding this comment

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

LGTM

@NuriAmari NuriAmari merged commit 6a21dfa into llvm:main Jun 7, 2025
10 of 11 checks passed
rorth pushed a commit to rorth/llvm-project that referenced this pull request Jun 11, 2025
DhruvSrivastavaX pushed a commit to DhruvSrivastavaX/lldb-for-aix that referenced this pull request Jun 12, 2025
tomtor pushed a commit to tomtor/llvm-project that referenced this pull request Jun 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants