Skip to content

Commit 39d33e4

Browse files
committed
Fix ASan error
When processing an CFG entrance, the expression engine does not have a CFG element reference set up, thus an Asan error would be triggered if we use the stale value. Instead, we pass the first element in the block which would be a workaround.
1 parent 90e82f1 commit 39d33e4

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

clang/lib/StaticAnalyzer/Core/ExprEngine.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2565,9 +2565,10 @@ void ExprEngine::processCFGBlockEntrance(const BlockEdge &L,
25652565
// since we are currently at the block entrance and the current reference
25662566
// would be stale. Ideally, we should pass on the terminator of the CFG
25672567
// block, but the terminator cannot be referred as a CFG element.
2568-
// Here we just pass the current stale block.
2569-
ProgramStateRef WidenedState = getWidenedLoopState(
2570-
Pred->getState(), LCtx, BlockCount, getCFGElementRef());
2568+
// Here we just pass the the first CFG element in the block.
2569+
ProgramStateRef WidenedState =
2570+
getWidenedLoopState(Pred->getState(), LCtx, BlockCount,
2571+
*nodeBuilder.getContext().getBlock()->ref_begin());
25712572
nodeBuilder.generateNode(WidenedState, Pred);
25722573
return;
25732574
}

0 commit comments

Comments
 (0)