File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
java/ql/test/library-tests/dataflow/entrypoint-types Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,14 @@ public K getField8() {
33
33
}
34
34
}
35
35
36
+ static class ChildObject extends ParameterizedTestObject <TestObject , Object > {
37
+ public Object field9 ;
38
+ }
39
+
40
+ class UnrelatedObject {
41
+ public String safeField ;
42
+ }
43
+
36
44
private static void sink (String sink ) {}
37
45
38
46
public static void test (TestObject source ) {
@@ -50,4 +58,16 @@ public static void testParameterized(
50
58
sink (source .getField8 ().field4 ); // $hasTaintFlow
51
59
sink (source .getField8 ().getField5 ()); // $hasTaintFlow
52
60
}
61
+
62
+ public static void testSubtype (ParameterizedTestObject <?, ?> source ) {
63
+ ChildObject subtypeSource = (ChildObject ) source ;
64
+ sink (subtypeSource .field6 ); // $hasTaintFlow
65
+ sink (subtypeSource .field7 .field1 ); // $hasTaintFlow
66
+ sink (subtypeSource .field7 .getField2 ()); // $hasTaintFlow
67
+ sink ((String ) subtypeSource .getField8 ()); // $hasTaintFlow
68
+ sink ((String ) subtypeSource .field9 ); // $hasTaintFlow
69
+ // Ensure that we are not tainting every subclass of Object
70
+ UnrelatedObject unrelated = (UnrelatedObject ) subtypeSource .getField8 ();
71
+ sink (unrelated .safeField ); // Safe
72
+ }
53
73
}
You can’t perform that action at this time.
0 commit comments