mirror of
https://github.com/github/codeql.git
synced 2025-12-24 04:36:35 +01:00
Merge pull request #9741 from tausbn/python-fix-bad-join-in-regexpbackref-getgroup
Python: Fix bad join in `RegExpBackRef::getGroup`
This commit is contained in:
@@ -1000,11 +1000,22 @@ class RegExpBackRef extends RegExpTerm, TRegExpBackRef {
|
|||||||
|
|
||||||
/** Gets the capture group this back reference refers to. */
|
/** Gets the capture group this back reference refers to. */
|
||||||
RegExpGroup getGroup() {
|
RegExpGroup getGroup() {
|
||||||
result.getLiteral() = this.getLiteral() and
|
this.hasLiteralAndNumber(result.getLiteral(), result.getNumber()) or
|
||||||
(
|
this.hasLiteralAndName(result.getLiteral(), result.getName())
|
||||||
result.getNumber() = this.getNumber() or
|
}
|
||||||
result.getName() = this.getName()
|
|
||||||
)
|
/** Join-order helper for `getGroup`. */
|
||||||
|
pragma[nomagic]
|
||||||
|
private predicate hasLiteralAndNumber(RegExpLiteral literal, int number) {
|
||||||
|
literal = this.getLiteral() and
|
||||||
|
number = this.getNumber()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Join-order helper for `getGroup`. */
|
||||||
|
pragma[nomagic]
|
||||||
|
private predicate hasLiteralAndName(RegExpLiteral literal, string name) {
|
||||||
|
literal = this.getLiteral() and
|
||||||
|
name = this.getName()
|
||||||
}
|
}
|
||||||
|
|
||||||
override RegExpTerm getChild(int i) { none() }
|
override RegExpTerm getChild(int i) { none() }
|
||||||
|
|||||||
Reference in New Issue
Block a user