mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-24 20:44:09 +00:00
[llvm-nm] Fix heap-use-after-free while executing 'llvm-nm -n --export-symbols' (#65668)
Use symbol's flags saved in `NMSymbol::SymFlags` inside `NMSymbol::isDefined()` since `BasicSymbolRef::getFlags()` requires the symbol's containing entity object to exist (which doesn't, causing llvm-nm to crash).
This commit is contained in:
parent
61757fbd04
commit
7457228629
@ -237,10 +237,8 @@ struct NMSymbol {
|
||||
std::string IndirectName;
|
||||
|
||||
bool isDefined() const {
|
||||
if (Sym.getRawDataRefImpl().p) {
|
||||
uint32_t Flags = cantFail(Sym.getFlags());
|
||||
return !(Flags & SymbolRef::SF_Undefined);
|
||||
}
|
||||
if (Sym.getRawDataRefImpl().p)
|
||||
return !(SymFlags & SymbolRef::SF_Undefined);
|
||||
return TypeChar != 'U';
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user