Skip to content

Commit

Permalink
fix: null dereference in getCrabVariable.
Browse files Browse the repository at this point in the history
This closes issue #98
  • Loading branch information
caballa committed Apr 18, 2024
1 parent 6759bea commit 4497e6f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/Clam/CfgBuilder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3720,7 +3720,14 @@ CfgBuilderImpl::getCrabBasicBlock(const BasicBlock *src,

llvm::Optional<var_t> CfgBuilderImpl::getCrabVariable(const llvm::Value &v) {
crab_lit_ref_t lit = m_lfac.getLit(v);
return (lit->isVar() ? llvm::Optional<var_t>(lit->getVar()) : llvm::Optional<var_t>());
if (lit == nullptr || !lit->isVar()) {
// getLit only supports integers and pointers. For instance, if v is the lhs of this instruction:
// %x = call { i64, i1 } @llvm.umul.with.overflow.i64(...)
// then lit will be null.
return llvm::None;
} else {
return llvm::Optional<var_t>(lit->getVar());
}
}


Expand Down

0 comments on commit 4497e6f

Please sign in to comment.