Skip to content

Commit 46e62cd

Browse files
yoffRasmusWL
andauthored
Apply suggestions from code review
Co-authored-by: Rasmus Wriedt Larsen <[email protected]>
1 parent 64685f3 commit 46e62cd

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

python/ql/lib/semmle/python/Concepts.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,8 @@ class RegexExecution extends DataFlow::Node {
366366

367367
RegexExecution() { this = range }
368368

369-
/** Gets the data flow node for the regex being compiled by this node. */
370-
DataFlow::Node getRegexNode() { result = range.getRegexNode() }
369+
/** Gets the data flow node for the regex being executed by this node. */
370+
DataFlow::Node getRegex() { result = range.getRegex() }
371371

372372
/** Gets a dataflow node for the string to be searched or matched against. */
373373
DataFlow::Node getString() { result = range.getString() }

python/ql/lib/semmle/python/frameworks/Stdlib.qll

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1525,7 +1525,7 @@ int stringArg(RegexExecutionMethod method) {
15251525
*
15261526
* See `RegexExecutionMethods`
15271527
*/
1528-
private class DirectRegex extends DataFlow::CallCfgNode, RegexExecution::Range {
1528+
private class DirectRegexExecution extends DataFlow::CallCfgNode, RegexExecution::Range {
15291529
RegexExecutionMethod method;
15301530

15311531
DirectRegex() { this = API::moduleImport("re").getMember(method).getACall() }
@@ -1611,7 +1611,7 @@ private import CompiledRegexes
16111611
*
16121612
* See https://docs.python.org/3/library/re.html#regular-expression-objects
16131613
*/
1614-
private class CompiledRegex extends DataFlow::CallCfgNode, RegexExecution::Range {
1614+
private class CompiledRegexExecution extends DataFlow::CallCfgNode, RegexExecution::Range {
16151615
DataFlow::Node regexNode;
16161616
RegexExecutionMethod method;
16171617

@@ -1640,14 +1640,13 @@ private class CompiledRegex extends DataFlow::CallCfgNode, RegexExecution::Range
16401640
* See https://docs.python.org/3/library/re.html#re.escape
16411641
*/
16421642
private class ReEscapeCall extends Escaping::Range, DataFlow::CallCfgNode {
1643-
DataFlow::Node regexNode;
1644-
16451643
ReEscapeCall() {
1646-
this = API::moduleImport("re").getMember("escape").getACall() and
1647-
regexNode in [this.getArg(0), this.getArgByName("pattern")]
1644+
this = API::moduleImport("re").getMember("escape").getACall()
16481645
}
16491646

1650-
override DataFlow::Node getAnInput() { result = regexNode }
1647+
override DataFlow::Node getAnInput() {
1648+
result in [this.getArg(0), this.getArgByName("pattern")]
1649+
}
16511650

16521651
override DataFlow::Node getOutput() { result = this }
16531652

0 commit comments

Comments
 (0)