Commit 0f12a7a
committed
[llvm-nm] Fix heap-use-after-free while executing 'llvm-nm -n --export-symbols'
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).
Here is the AddressSanitizer report:
==3324663==ERROR: AddressSanitizer: heap-use-after-free on address 0x60e000000200
READ of size 8 at 0x60e000000200 thread T0
#0 0x55c6536785d8 in llvm::object::BasicSymbolRef::getFlags() const llvm-project/llvm/include/llvm/Object/SymbolicFile.h:207:24
#1 0x55c6536785d8 in (anonymous namespace)::NMSymbol::isDefined() const llvm-project/llvm/tools/llvm-nm/llvm-nm.cpp:241:371 parent 47daf14 commit 0f12a7a
1 file changed
+2
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
237 | 237 | | |
238 | 238 | | |
239 | 239 | | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
| 240 | + | |
| 241 | + | |
244 | 242 | | |
245 | 243 | | |
246 | 244 | | |
| |||
0 commit comments