Skip to content

Commit c73941b

Browse files
committed
Extend incomplete-sequence-of-chars.ql to cover String arrays
1 parent 72d8455 commit c73941b

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

codeql-custom-queries-java/queries/likely-bugs/incomplete-sequence-of-chars.ql

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,19 @@ class IncompleteCharArrayExpr extends IncompleteSequenceExpr, ArrayInit {
149149
}
150150
}
151151

152+
class IncompleteStringArrayExpr extends IncompleteSequenceExpr, ArrayInit {
153+
override
154+
string getString() {
155+
result = concat(string char | char = charAt(_))
156+
}
157+
158+
override
159+
string charAt(int index) {
160+
result = getInit(index).(StringLiteral).getValue()
161+
and result.length() = 1
162+
}
163+
}
164+
152165
from IncompleteSequenceExpr incompleteSeq, int index, string missingChar
153166
where
154167
hasSequenceStart(incompleteSeq)

0 commit comments

Comments
 (0)