Added test cases

This commit is contained in:
Tony Torralba
2022-01-12 11:06:58 +01:00
parent 715d372572
commit c2105e506b
2 changed files with 26 additions and 0 deletions

View File

@@ -63,4 +63,27 @@ public class StringBuilderTests {
sb.insert(45, taint());
sink(sb.toString());
}
static void stringBuilderGetCharsBad() {
StringBuilder sb = new StringBuilder();
sb.append("from preferences select locale where user=''");
sb.append(taint());
char[] chars = null;
sb.getChars(0, 0, chars, 0);
sink(new String(chars));
}
static void stringBuilderSubSequenceBad() {
StringBuilder sb = new StringBuilder();
sb.append("from preferences select locale where user=''");
sb.append(taint());
sink(sb.subSequence(0, 0).toString());
}
static void stringBuilderSubstringBad() {
StringBuilder sb = new StringBuilder();
sb.append("from preferences select locale where user=''");
sb.append(taint());
sink(sb.substring(0, 0));
}
}