File tree Expand file tree Collapse file tree 2 files changed +3
-9
lines changed
src/experimental/Security/CWE/CWE-703
test/experimental/query-tests/Security/CWE/CWE-703/semmle/tests Expand file tree Collapse file tree 2 files changed +3
-9
lines changed Original file line number Diff line number Diff line change 38
38
fc .getTargetType ( ) .( Class ) .getABaseClass + ( ) .hasGlobalOrStdName ( "exception" ) or
39
39
fc .getTargetType ( ) .( Class ) .getABaseClass + ( ) .hasGlobalOrStdName ( "CException" )
40
40
) and
41
+ fc instanceof ExprInVoidContext and
41
42
not fc .isInMacroExpansion ( ) and
42
- not exists ( ThrowExpr texp | fc .getEnclosingStmt ( ) = texp .getEnclosingStmt ( ) ) and
43
- not exists ( FunctionCall fctmp | fctmp .getAnArgument ( ) = fc ) and
44
- not fc instanceof ConstructorDirectInit and
45
- not fc .getEnclosingStmt ( ) instanceof DeclStmt and
46
- not fc instanceof ConstructorDelegationInit and
47
- not fc .getParent ( ) instanceof Initializer and
48
- not fc .getParent ( ) instanceof AllocationExpr and
49
- msg = "This object does not generate an exception."
43
+ msg = "Object creation of exception type on stack. Did you forget the throw keyword?"
50
44
select fc , msg
Original file line number Diff line number Diff line change 1
- | test.cpp:35:3:35:33 | call to runtime_error | This object does not generate an exception. |
1
+ | test.cpp:35:3:35:33 | call to runtime_error | Object creation of exception type on stack. Did you forget the throw keyword? |
2
2
| test.cpp:41:3:41:11 | call to funcTest1 | There is an exception in the function that requires your attention. |
3
3
| test.cpp:42:3:42:9 | call to DllMain | DllMain contains an exeption not wrapped in a try..catch block. |
You can’t perform that action at this time.
0 commit comments