forked from OSchip/llvm-project
[llvm-nm] Fix use-after-free for MachOUniversalBinaries
MachOObjectFile::getHostArch() returns a temporary, and getArchName returns a StringRef pointing to a temporary std::string. No tests since it doesn't trigger any errors except with the sanitizers. llvm-svn: 347230
This commit is contained in:
parent
026a2a5152
commit
fe034625df
|
@ -1889,7 +1889,8 @@ static void dumpSymbolNamesFromFile(std::string &Filename) {
|
||||||
// No architecture flags were specified so if this contains a slice that
|
// No architecture flags were specified so if this contains a slice that
|
||||||
// matches the host architecture dump only that.
|
// matches the host architecture dump only that.
|
||||||
if (!ArchAll) {
|
if (!ArchAll) {
|
||||||
StringRef HostArchName = MachOObjectFile::getHostArch().getArchName();
|
Triple HostTriple = MachOObjectFile::getHostArch();
|
||||||
|
StringRef HostArchName = HostTriple.getArchName();
|
||||||
for (MachOUniversalBinary::object_iterator I = UB->begin_objects(),
|
for (MachOUniversalBinary::object_iterator I = UB->begin_objects(),
|
||||||
E = UB->end_objects();
|
E = UB->end_objects();
|
||||||
I != E; ++I) {
|
I != E; ++I) {
|
||||||
|
|
Loading…
Reference in New Issue