Skip to content

Commit 05adfec

Browse files
committed
account for more patterns in IntegerLiteral.getValue
1 parent 35d5bae commit 05adfec

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

ql/src/codeql_ruby/ast/Literal.qll

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,23 @@ class IntegerLiteral extends NumericLiteral, TIntegerLiteral {
5151
exists(string s, string values, string str |
5252
s = this.getValueText() and
5353
(
54-
s.matches("0b%") and values = "01" and str = s.suffix(2)
54+
(s.matches("0b%") or s.matches("0B%")) and
55+
values = "01" and
56+
str = s.suffix(2)
5557
or
56-
s.matches("0x%") and values = "0123456789abcdef" and str = s.suffix(2)
58+
(s.matches("0x%") or s.matches("0X%")) and
59+
values = "0123456789abcdef" and
60+
str = s.suffix(2)
5761
or
5862
s.charAt(0) = "0" and
59-
not s.charAt(1) = ["b", "x"] and
63+
not s.charAt(1) = ["b", "B", "x", "X"] and
6064
values = "01234567" and
6165
str = s.suffix(1)
6266
or
67+
(s.matches("0o%") or s.matches("0O%")) and
68+
values = "01234567" and
69+
str = s.suffix(2)
70+
or
6371
s.charAt(0) != "0" and values = "0123456789" and str = s
6472
)
6573
|

0 commit comments

Comments
 (0)