Skip to content

Commit e2dc975

Browse files
Covered copyOfRange() and clone() in ArrayUpdate
1 parent d218813 commit e2dc975

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

java/ql/src/experimental/semmle/code/java/security/StaticInitializationVectorQuery.qll

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ private class ArrayUpdate extends Expr {
5151
)
5252
or
5353
exists(StaticMethodAccess ma |
54-
ma.getMethod().hasQualifiedName("java.util", "Arrays", "copyOf") and
54+
ma.getMethod().hasQualifiedName("java.util", "Arrays", ["copyOf", "copyOfRange"]) and
5555
ma = this and
5656
ma = array
5757
)
@@ -66,6 +66,10 @@ private class ArrayUpdate extends Expr {
6666
m.hasQualifiedName("java.security", "SecureRandom", "nextBytes") or
6767
m.hasQualifiedName("java.util", "Random", "nextBytes")
6868
)
69+
or
70+
exists(MethodAccess ma, Method m | m = ma.getMethod() |
71+
m.getDeclaringType().hasName("byte[]") and m.hasName("clone") and ma = this and ma = array
72+
)
6973
}
7074

7175
/** Returns the updated array. */

0 commit comments

Comments
 (0)