mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-15 19:24:33 +00:00
Fix PR23914.
r226830 moved the declaration of Buf to a nested scope, resulting in a dangling reference (in StringRef Name), and a use-after-free. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240357 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -842,12 +842,12 @@ void ELFObjectWriter::computeSymbolTable(
|
||||
// seems that this information is not easily accessible from the
|
||||
// ELFObjectWriter.
|
||||
StringRef Name = Symbol.getName();
|
||||
SmallString<32> Buf;
|
||||
if (!Name.startswith("?") && !Name.startswith("@?") &&
|
||||
!Name.startswith("__imp_?") && !Name.startswith("__imp_@?")) {
|
||||
// This symbol isn't following the MSVC C++ name mangling convention. We
|
||||
// can thus safely interpret the @@@ in symbol names as specifying symbol
|
||||
// versioning.
|
||||
SmallString<32> Buf;
|
||||
size_t Pos = Name.find("@@@");
|
||||
if (Pos != StringRef::npos) {
|
||||
Buf += Name.substr(0, Pos);
|
||||
|
Reference in New Issue
Block a user