File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed
src/Likely Bugs/Arithmetic
test/query-tests/security/CWE-190/semmle/tests Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -27,10 +27,11 @@ class DangerousAssignOpExpr extends AssignOp {
2727
2828predicate problematicCasting ( Type t , Expr e ) { e .getType ( ) .( NumType ) .widerThan ( t ) }
2929
30- from DangerousAssignOpExpr a , Expr e
30+ from DangerousAssignOpExpr a , Expr e , Variable v
3131where
3232 e = a .getSource ( ) and
33- problematicCasting ( a .getDest ( ) .getType ( ) , e )
33+ problematicCasting ( a .getDest ( ) .getType ( ) , e ) and
34+ v = a .getDest ( ) .( VarAccess ) .getVariable ( )
3435select a ,
35- "Implicit cast of source type " + e . getType ( ) .getName ( ) + " to narrower destination type " +
36- a . getDest ( ) . getType ( ) .getName ( ) + "."
36+ "Implicit cast of source $@ to narrower destination type " + a . getDest ( ) . getType ( ) .getName ( ) + "." ,
37+ v , "type " + e . getType ( ) .getName ( )
Original file line number Diff line number Diff line change 1- | Test.java:68:5:68:25 | ...+=... | Implicit cast of source type long to narrower destination type int. |
2- | Test.java:87:4:87:9 | ...+=... | Implicit cast of source type long to narrower destination type int. |
1+ | Test.java:68:5:68:25 | ...+=... | Implicit cast of source $@ to narrower destination type int. | Test.java:64:4:64:13 | int i | type long |
2+ | Test.java:87:4:87:9 | ...+=... | Implicit cast of source $@ to narrower destination type int. | Test.java:81:4:81:13 | int i | type long |
You can’t perform that action at this time.
0 commit comments