Skip to content

Commit aa5ef57

Browse files
Fix a use-after-free in getPackageInterfacePathIfInSamePackage
Fix a use-after-free bug in package-name extraction code, where the BumpPtrAllcoator is destroyed before a StringRef that uses the allocated name is used.
1 parent 7b5502b commit aa5ef57

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/Serialization/SerializedModuleLoader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ SerializedModuleBaseName::getPackageInterfacePathIfInSamePackage(
611611

612612
if (fs.exists(packagePath)) {
613613
// Read the interface file and extract its package-name argument value
614-
StringRef result;
614+
std::string result;
615615
if (auto packageFile = llvm::MemoryBuffer::getFile(packagePath)) {
616616
llvm::BumpPtrAllocator alloc;
617617
llvm::StringSaver argSaver(alloc);

0 commit comments

Comments
 (0)