File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed
java/ql/lib/semmle/code/java/security Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -9,15 +9,14 @@ private predicate initializedWithConstants(ArrayCreationExpr array) {
9
9
// creating an array without an initializer, for example `new byte[8]`
10
10
not exists ( array .getInit ( ) )
11
11
or
12
- // creating a multidimensional array with an initializer like `{ new byte[8], new byte[16] }`
13
- // This works around https://github.com/github/codeql/issues/6552 -- change me once there is
14
- // a better way to distinguish nested initializers that create zero-filled arrays
15
- // (e.g. `new byte[1]`) from those with an initializer list (`new byte[] { 1 }` or just `{ 1 }`)
16
- array .getInit ( ) .getAnInit ( ) .getAChildExpr ( ) instanceof IntegerLiteral
17
- or
18
- // creating an array wit an initializer like `new byte[] { 1, 2 }`
19
- forex ( Expr element | element = array .getInit ( ) .getAnInit ( ) |
12
+ initializedWithConstantsHelper ( array .getInit ( ) )
13
+ }
14
+
15
+ private predicate initializedWithConstantsHelper ( ArrayInit arInit ) {
16
+ forex ( Expr element | element = arInit .getAnInit ( ) |
20
17
element instanceof CompileTimeConstantExpr
18
+ or
19
+ initializedWithConstantsHelper ( element )
21
20
)
22
21
}
23
22
You can’t perform that action at this time.
0 commit comments