Skip to content

Commit b822216

Browse files
committed
Rust: Ensure that TPositionalArgumentPosition is large enough for struct expressions
1 parent 6efd844 commit b822216

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

rust/ql/lib/codeql/rust/elements/internal/InvocationExprImpl.qll

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@ module Impl {
99
// For the type `FunctionPosition` used by type inference, we work with function-call syntax
1010
// adjusted positions, so a call like `x.m(a, b, c)` needs positions `0` through `3`; for this
1111
// reason, there is no `- 1` after `max(...)` below.
12-
i in [0 .. max([any(ParamList l).getNumberOfParams(), any(ArgList l).getNumberOfArgs()])]
12+
i in [0 .. max([
13+
any(ParamList l).getNumberOfParams(),
14+
any(ArgList l).getNumberOfArgs(),
15+
any(StructFieldList l).getNumberOfFields() // Positions are used for struct expressions in type inference
16+
]
17+
)]
1318
} or
1419
TSelfArgumentPosition() or
1520
TTypeQualifierArgumentPosition()

0 commit comments

Comments
 (0)