Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1092cb9

Browse files
committed
CPP: Have reachability flow to the Handler as well as the CAtchBlock of an exception.
1 parent 6e940d7 commit 1092cb9

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

cpp/ql/src/semmle/code/cpp/controlflow/BasicBlocks.qll

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,14 @@ class BasicBlock extends ControlFlowNodeBase {
245245
predicate isReachable() {
246246
exists(Function f | f.getBlock() = this)
247247
or
248-
exists(TryStmt t, BasicBlock tryblock | this = t.getACatchClause() and tryblock.isReachable() and tryblock.contains(t))
249-
or
248+
exists(TryStmt t, BasicBlock tryblock |
249+
(
250+
this = t.getACatchClause() or
251+
this.(Handler).getTryStmt() = t
252+
) and
253+
tryblock.isReachable() and
254+
tryblock.contains(t)
255+
) or
250256
exists(BasicBlock pred | pred.getASuccessor() = this and pred.isReachable())
251257
}
252258

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,2 @@
1-
| ODASA-5692.cpp:11:18:13:3 | <handler> |
2-
| ODASA-5692.cpp:11:18:13:3 | <handler> |
3-
| ODASA-5692.cpp:14:15:15:12 | <handler> |
4-
| ODASA-5692.cpp:14:15:15:12 | <handler> |
51
| exceptions.cpp:25:13:30:9 | ExprStmt |
62
| exceptions.cpp:26:13:26:13 | ExprStmt |
7-
| exceptions.cpp:32:19:34:5 | <handler> |
8-
| exceptions.cpp:35:19:37:5 | <handler> |

0 commit comments

Comments
 (0)