Skip to content

Commit 1a8a70d

Browse files
committed
mark the range [0-?] as good in the overly-large-range query
1 parent 1fba345 commit 1a8a70d

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

javascript/ql/test/query-tests/Security/CWE-020/SuspiciousRegexpRange/tst.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,6 @@ var overlapsWithClass1 = /[0-9\d]/; // NOT OK
2727
var overlapsWithClass2 = /[\w,.-?:*+]/; // NOT OK
2828

2929
var tst2 = /^([-]|[-])+$/; // OK
30-
var tst3 = /[0-9-]/; // OK
30+
var tst3 = /[0-9-]/; // OK
31+
32+
var question = /[0-?]/; // OK. matches one of: 0123456789:;<=>?

shared/regex/codeql/regex/OverlyLargeRangeQuery.qll

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@ module Make<RegexTreeViewSig TreeImpl> {
129129
or
130130
// starting from the zero byte is a good indication that it's purposely matching a large range.
131131
result.isRange(0.toUnicode(), _)
132+
or
133+
// the range 0123456789:;<=>? is intentional
134+
result.isRange("0", "?")
132135
}
133136

134137
/** Gets a char between (and including) `low` and `high`. */

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy