File tree Expand file tree Collapse file tree
java/ql/lib/semmle/code/java/security Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,15 +9,14 @@ private predicate initializedWithConstants(ArrayCreationExpr array) {
99 // creating an array without an initializer, for example `new byte[8]`
1010 not exists ( array .getInit ( ) )
1111 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 ( ) |
2017 element instanceof CompileTimeConstantExpr
18+ or
19+ initializedWithConstantsHelper ( element )
2120 )
2221}
2322
You can’t perform that action at this time.
0 commit comments