зеркало из https://github.com/github/codeql.git
Merge pull request #2927 from aschackmull/java/taintgettersetter-tests
Java: Add some more taint-getter-setter tests.
This commit is contained in:
Коммит
f8bf055fe1
|
@ -34,4 +34,38 @@ public class A {
|
|||
Box b4 = Box.mk(taint());
|
||||
sink(b4.getS1());
|
||||
}
|
||||
|
||||
static class Box2 {
|
||||
String s;
|
||||
String getS() { return s; }
|
||||
void setS(String s) { this.s = s; }
|
||||
|
||||
Box2(String s) {
|
||||
setS(s + "1");
|
||||
}
|
||||
String getS1() { return getS() + "2"; }
|
||||
String getS2() { return step(getS() + "_") + "2"; }
|
||||
void setS1(String s) { setS("3" + s); }
|
||||
void setS2(String s) { setS("3" + step("_" + s)); }
|
||||
static Box2 mk(String s) {
|
||||
Box2 b = new Box2("");
|
||||
b.setS(step(s));
|
||||
return b;
|
||||
}
|
||||
}
|
||||
|
||||
void foo2(Box2 b1, Box2 b2) {
|
||||
b1.setS1(taint());
|
||||
sink(b1.getS1());
|
||||
|
||||
b2.setS2(taint());
|
||||
sink(b2.getS2());
|
||||
|
||||
String t3 = taint();
|
||||
Box2 b3 = new Box2(step(t3));
|
||||
sink(b3.s);
|
||||
|
||||
Box2 b4 = Box2.mk(taint());
|
||||
sink(b4.getS1());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,3 +2,7 @@
|
|||
| A.java:27:14:27:20 | taint(...) | A.java:28:10:28:19 | getS2(...) |
|
||||
| A.java:30:17:30:23 | taint(...) | A.java:32:10:32:13 | b3.s |
|
||||
| A.java:34:21:34:27 | taint(...) | A.java:35:10:35:19 | getS1(...) |
|
||||
| A.java:58:14:58:20 | taint(...) | A.java:59:10:59:19 | getS1(...) |
|
||||
| A.java:61:14:61:20 | taint(...) | A.java:62:10:62:19 | getS2(...) |
|
||||
| A.java:64:17:64:23 | taint(...) | A.java:66:10:66:13 | b3.s |
|
||||
| A.java:68:23:68:29 | taint(...) | A.java:69:10:69:19 | getS1(...) |
|
||||
|
|
Загрузка…
Ссылка в новой задаче