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 {
27
27
28
28
predicate problematicCasting ( Type t , Expr e ) { e .getType ( ) .( NumType ) .widerThan ( t ) }
29
29
30
- from DangerousAssignOpExpr a , Expr e
30
+ from DangerousAssignOpExpr a , Expr e , Variable v
31
31
where
32
32
e = a .getSource ( ) and
33
- problematicCasting ( a .getDest ( ) .getType ( ) , e )
33
+ problematicCasting ( a .getDest ( ) .getType ( ) , e ) and
34
+ v = a .getDest ( ) .( VarAccess ) .getVariable ( )
34
35
select 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