Skip to content

Commit 76663f8

Browse files
committed
Ruby: Avoid multiple RegExpEscape::getValue results
1 parent 0d71f0a commit 76663f8

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

ruby/ql/lib/codeql/ruby/security/performance/RegExpTreeView.qll

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,9 @@ class RegExpEscape extends RegExpNormalChar {
405405
result = this.getUnicode()
406406
}
407407

408-
predicate isIdentityEscape() { not this.getUnescaped() in ["n", "r", "t"] }
408+
predicate isIdentityEscape() {
409+
not this.getUnescaped() in ["n", "r", "t"] and not this.isUnicode()
410+
}
409411

410412
/**
411413
* Gets the text for this escape. That is e.g. "\w".

ruby/ql/test/library-tests/regexp/regexp.expected

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,4 +271,3 @@ regExpNormalCharValue
271271
| regexp.rb:72:17:72:17 | f | f |
272272
| regexp.rb:79:2:79:4 | abc | abc |
273273
| regexp.rb:82:2:82:7 | \\u{987 | \u0987 |
274-
| regexp.rb:82:2:82:7 | \\u{987 | u{987 |

0 commit comments

Comments
 (0)