Skip to content

Commit b0cfa1d

Browse files
committed
Python: Make "..Call" modeling classes extend DataFlow::CfgNode
1 parent bfa5d18 commit b0cfa1d

File tree

1 file changed

+8
-14
lines changed
  • python/ql/src/experimental/semmle/python/frameworks

1 file changed

+8
-14
lines changed

python/ql/src/experimental/semmle/python/frameworks/Stdlib.qll

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -394,30 +394,24 @@ private module Stdlib {
394394
* A call to the builtin `exec` function.
395395
* See https://docs.python.org/3/library/functions.html#exec
396396
*/
397-
private class BuiltinsExecCall extends CodeExecution::Range {
398-
CallNode call;
397+
private class BuiltinsExecCall extends CodeExecution::Range, DataFlow::CfgNode {
398+
override CallNode node;
399399

400-
BuiltinsExecCall() {
401-
this.asCfgNode() = call and
402-
call.getFunction() = builtins_attr("exec").asCfgNode()
403-
}
400+
BuiltinsExecCall() { node.getFunction() = builtins_attr("exec").asCfgNode() }
404401

405-
override DataFlow::Node getCode() { result.asCfgNode() = call.getArg(0) }
402+
override DataFlow::Node getCode() { result.asCfgNode() = node.getArg(0) }
406403
}
407404

408405
/**
409406
* A call to the builtin `eval` function.
410407
* See https://docs.python.org/3/library/functions.html#eval
411408
*/
412-
private class BuiltinsEvalCall extends CodeExecution::Range {
413-
CallNode call;
409+
private class BuiltinsEvalCall extends CodeExecution::Range, DataFlow::CfgNode {
410+
override CallNode node;
414411

415-
BuiltinsEvalCall() {
416-
this.asCfgNode() = call and
417-
call.getFunction() = builtins_attr("eval").asCfgNode()
418-
}
412+
BuiltinsEvalCall() { node.getFunction() = builtins_attr("eval").asCfgNode() }
419413

420-
override DataFlow::Node getCode() { result.asCfgNode() = call.getArg(0) }
414+
override DataFlow::Node getCode() { result.asCfgNode() = node.getArg(0) }
421415
}
422416

423417
/** An additional taint step for calls to the builtin function `compile` */

0 commit comments

Comments
 (0)