Skip to content

Commit

Permalink
Fix null pointer dereference when a file is not an object file
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorn3 committed Aug 14, 2024
1 parent 7c972d7 commit 901c9da
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions compiler/rustc_llvm/llvm-wrapper/SymbolWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ LLVMRustGetSymbols(char *BufPtr, size_t BufLen, void *State,
return ErrorCallback(toString(ObjOrErr.takeError()).c_str());
}
std::unique_ptr<object::SymbolicFile> Obj = std::move(*ObjOrErr);
if (Obj == nullptr) {
return 0;
}

for (const object::BasicSymbolRef &S : Obj->symbols()) {
if (!isArchiveSymbol(S))
Expand Down

0 comments on commit 901c9da

Please sign in to comment.