Skip to content

Commit 67ae121

Browse files
committed
logic fix
1 parent 213d6e8 commit 67ae121

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

cpp/common/src/codingstandards/cpp/Concurrency.qll

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ pragma[inline]
231231
ControlFlowNode getAThreadContextAwarePredecessor(ControlFlowNode start, ControlFlowNode end) {
232232
result = getAThreadContextAwareSuccessor(start) and
233233
not result = getAThreadContextAwareSuccessor(end) and
234-
not result = end
234+
not result = end
235235
}
236236

237237
/**
@@ -402,6 +402,13 @@ class LockProtectedControlFlowNode extends ThreadedCFN {
402402
unlock.(MutexFunctionCall).isUnlock()
403403
// note that we don't check that it's the same lock -- this is left
404404
// to the caller to enforce this condition.
405+
406+
// Because of the way that `getAThreadContextAwarePredecessor` works, it is possible
407+
// for operations PAST it to be technically part of the predecessors.
408+
// Thus, we need to make sure that this lock (to be actually)
409+
// an unlock along the same path it must be the case that when we
410+
// supply it as the starting point of the search it hits the try lock
411+
and getAThreadContextAwareSuccessor(unlock) = this
405412
) and
406413
(lock instanceof MutexFunctionCall implies not this.(MutexFunctionCall).isUnlock())
407414
)

0 commit comments

Comments
 (0)