Skip to content

Commit 4375452

Browse files
committed
more IntegerLiteral.getValue improvements
1 parent 05adfec commit 4375452

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

ql/src/codeql_ruby/ast/Literal.qll

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,22 +49,22 @@ class IntegerLiteral extends NumericLiteral, TIntegerLiteral {
4949

5050
final int getValue() {
5151
exists(string s, string values, string str |
52-
s = this.getValueText() and
52+
s = this.getValueText().toLowerCase() and
5353
(
54-
(s.matches("0b%") or s.matches("0B%")) and
54+
s.matches("0b%") and
5555
values = "01" and
5656
str = s.suffix(2)
5757
or
58-
(s.matches("0x%") or s.matches("0X%")) and
58+
s.matches("0x%") and
5959
values = "0123456789abcdef" and
6060
str = s.suffix(2)
6161
or
6262
s.charAt(0) = "0" and
63-
not s.charAt(1) = ["b", "B", "x", "X"] and
63+
not s.charAt(1) = ["b", "x", "o"] and
6464
values = "01234567" and
6565
str = s.suffix(1)
6666
or
67-
(s.matches("0o%") or s.matches("0O%")) and
67+
s.matches("0o%") and
6868
values = "01234567" and
6969
str = s.suffix(2)
7070
or

0 commit comments

Comments
 (0)