mirror of
https://github.com/github/codeql.git
synced 2025-12-17 09:13:20 +01:00
20 lines
584 B
Plaintext
20 lines
584 B
Plaintext
/**
|
|
* @name Test for array creations
|
|
*/
|
|
|
|
import csharp
|
|
|
|
from Assignment a, ArrayCreation e, CastExpr cast
|
|
where
|
|
a.getLValue().(VariableAccess).getTarget().hasName("os") and
|
|
e.getEnclosingCallable().hasName("MainElementAccess") and
|
|
e = a.getRValue() and
|
|
not e.isImplicitlyTyped() and
|
|
e.isImplicitlySized() and
|
|
e.getArrayType().getDimension() = 1 and
|
|
e.getArrayType().getRank() = 1 and
|
|
e.getInitializer().getNumberOfElements() = 1 and
|
|
e.getInitializer().getElement(0) = cast and
|
|
cast.getExpr() instanceof ParameterAccess
|
|
select e, e.getInitializer().getElement(0)
|