swift
78984368 - [ClangImporter] Fix use-after-free of CodeGenOpts.Argv0

Commit
84 days ago
[ClangImporter] Fix use-after-free of CodeGenOpts.Argv0 clang::createInvocation stores Argv0 as a raw const char* pointing into the first element of its argument list. In createClangInvocation that points into the local driverArgs vector, which is destroyed before the invocation is used, leaving Argv0 dangling. The PCH worker thread later hits this in initTargetOptions when assigning Argv0 into MCTargetOptions (a std::string), producing a heap-use-after-free under ASan. Re-anchor Argv0 to ClangImporterOpts.clangPath, which is owned by the ASTContext and outlives the invocation. rdar://180460686 (cherry picked from commit 67bd4a97f4647ee9af1a9c9018af3da2a830cf93)
Committer
Parents
Loading