mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
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.
This commit is contained in:
@@ -611,7 +611,7 @@ SerializedModuleBaseName::getPackageInterfacePathIfInSamePackage(
|
||||
|
||||
if (fs.exists(packagePath)) {
|
||||
// Read the interface file and extract its package-name argument value
|
||||
StringRef result;
|
||||
std::string result;
|
||||
if (auto packageFile = llvm::MemoryBuffer::getFile(packagePath)) {
|
||||
llvm::BumpPtrAllocator alloc;
|
||||
llvm::StringSaver argSaver(alloc);
|
||||
|
||||
Reference in New Issue
Block a user