Skip to content

Commit 72942af

Browse files
authored
Merge pull request #10220 from erik-krogh/overlapsWithNothing
print a correct range for ranges that doesn't contain any alpha-numeric chars
2 parents 4070860 + 7fd426e commit 72942af

File tree

6 files changed

+7
-4
lines changed

6 files changed

+7
-4
lines changed

java/ql/lib/semmle/code/java/security/OverlyLargeRangeQuery.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ module RangePrinter {
173173
}
174174

175175
/** Gets the number of parts we should print for a given `range`. */
176-
private int parts(OverlyWideRange range) { result = 1 + strictcount(cutoff(range, _)) }
176+
private int parts(OverlyWideRange range) { result = 1 + count(cutoff(range, _)) }
177177

178178
/** Holds if the given part of a range should span from `low` to `high`. */
179179
private predicate part(OverlyWideRange range, int part, string low, string high) {

javascript/ql/lib/semmle/javascript/security/OverlyLargeRangeQuery.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ module RangePrinter {
173173
}
174174

175175
/** Gets the number of parts we should print for a given `range`. */
176-
private int parts(OverlyWideRange range) { result = 1 + strictcount(cutoff(range, _)) }
176+
private int parts(OverlyWideRange range) { result = 1 + count(cutoff(range, _)) }
177177

178178
/** Holds if the given part of a range should span from `low` to `high`. */
179179
private predicate part(OverlyWideRange range, int part, string low, string high) {

python/ql/lib/semmle/python/security/OverlyLargeRangeQuery.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ module RangePrinter {
173173
}
174174

175175
/** Gets the number of parts we should print for a given `range`. */
176-
private int parts(OverlyWideRange range) { result = 1 + strictcount(cutoff(range, _)) }
176+
private int parts(OverlyWideRange range) { result = 1 + count(cutoff(range, _)) }
177177

178178
/** Holds if the given part of a range should span from `low` to `high`. */
179179
private predicate part(OverlyWideRange range, int part, string low, string high) {

ruby/ql/lib/codeql/ruby/security/OverlyLargeRangeQuery.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ module RangePrinter {
173173
}
174174

175175
/** Gets the number of parts we should print for a given `range`. */
176-
private int parts(OverlyWideRange range) { result = 1 + strictcount(cutoff(range, _)) }
176+
private int parts(OverlyWideRange range) { result = 1 + count(cutoff(range, _)) }
177177

178178
/** Holds if the given part of a range should span from `low` to `high`. */
179179
private predicate part(OverlyWideRange range, int part, string low, string high) {

ruby/ql/test/query-tests/security/cwe-020/SuspiciousRegexpRange/OverlyLargeRangeQuery.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@
88
| suspicous_regexp_range.rb:23:20:23:22 | 7-F | Suspicious character range that is equivalent to [7-9:;<=>?@A-F]. |
99
| suspicous_regexp_range.rb:25:24:25:26 | 0-9 | Suspicious character range that overlaps with \\d in the same character class. |
1010
| suspicous_regexp_range.rb:27:27:27:29 | .-? | Suspicious character range that overlaps with \\w in the same character class, and is equivalent to [.\\/0-9:;<=>?]. |
11+
| suspicous_regexp_range.rb:33:28:33:30 | %-. | Suspicious character range that is equivalent to [%&'()*+,\\-.]. |

ruby/ql/test/query-tests/security/cwe-020/SuspiciousRegexpRange/suspicous_regexp_range.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,5 @@
2929
escapes = /[\000-\037\047\134\177-\377]/n # OK - they are escapes
3030

3131
nested = /[a-z&&[^a-c]]/ # OK
32+
33+
overlapsWithNothing = /[\w_%-.]/;

0 commit comments

Comments
 (0)