mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
Python: Regexp: Handle repetions {n} (with no ,)
This commit is contained in:
@@ -472,8 +472,12 @@ abstract class RegexString extends Expr {
|
||||
this.getChar(endin) = "}" and
|
||||
end > start and
|
||||
exists(string multiples | multiples = this.getText().substring(start + 1, endin) |
|
||||
multiples.regexpMatch("0+") and maybe_empty = true
|
||||
or
|
||||
multiples.regexpMatch("0*,[0-9]*") and maybe_empty = true
|
||||
or
|
||||
multiples.regexpMatch("0*[1-9][0-9]*") and maybe_empty = false
|
||||
or
|
||||
multiples.regexpMatch("0*[1-9][0-9]*,[0-9]*") and maybe_empty = false
|
||||
) and
|
||||
not exists(int mid |
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
| test.py:41:12:41:18 | Str | This regular expression includes duplicate character 'A' in a set of characters. |
|
||||
| test.py:42:12:42:19 | Str | This regular expression includes duplicate character '0' in a set of characters. |
|
||||
| test.py:43:12:43:21 | Str | This regular expression includes duplicate character '-' in a set of characters. |
|
||||
| test.py:44:12:44:18 | Str | This regular expression includes duplicate character 'A' in a set of characters. |
|
||||
| test.py:45:12:45:19 | Str | This regular expression includes duplicate character '0' in a set of characters. |
|
||||
| test.py:46:12:46:21 | Str | This regular expression includes duplicate character '-' in a set of characters. |
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
| test.py:4:12:4:19 | Str | This regular expression includes an unmatchable caret at offset 1. |
|
||||
| test.py:5:12:5:23 | Str | This regular expression includes an unmatchable caret at offset 5. |
|
||||
| test.py:6:12:6:21 | Str | This regular expression includes an unmatchable caret at offset 2. |
|
||||
| test.py:74:12:74:27 | Str | This regular expression includes an unmatchable caret at offset 8. |
|
||||
| test.py:77:12:77:27 | Str | This regular expression includes an unmatchable caret at offset 8. |
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
| test.py:29:12:29:19 | Str | This regular expression includes an unmatchable dollar at offset 3. |
|
||||
| test.py:30:12:30:23 | Str | This regular expression includes an unmatchable dollar at offset 3. |
|
||||
| test.py:31:12:31:20 | Str | This regular expression includes an unmatchable dollar at offset 2. |
|
||||
| test.py:75:12:75:26 | Str | This regular expression includes an unmatchable dollar at offset 3. |
|
||||
| test.py:78:12:78:26 | Str | This regular expression includes an unmatchable dollar at offset 3. |
|
||||
|
||||
@@ -35,6 +35,9 @@ re.compile(b"[$] ")
|
||||
re.compile(b"\$ ")
|
||||
re.compile(b"abc$(?m)")
|
||||
re.compile(b"abc$()")
|
||||
re.compile(b"((a$)|b)*")
|
||||
re.compile(b"((a$)|b){4}")
|
||||
re.compile(b"((a$).*)")
|
||||
|
||||
|
||||
#Duplicate character in set
|
||||
|
||||
Reference in New Issue
Block a user