mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
Merge pull request #15695 from github/tausbn/python-add-copy-method-as-copy-step
Python: Add `.copy()` method call as copy step
This commit is contained in:
@@ -195,6 +195,8 @@ predicate copyStep(DataFlow::CfgNode nodeFrom, DataFlow::CfgNode nodeTo) {
|
||||
call = API::moduleImport("copy").getMember(["copy", "deepcopy"]).getACall() and
|
||||
call.getArg(0) = nodeFrom
|
||||
)
|
||||
or
|
||||
nodeTo.(DataFlow::MethodCallNode).calls(nodeFrom, "copy")
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -216,3 +216,9 @@ def flow_from_within_deepcopy_fp():
|
||||
def flow_through_deepcopy_fp(x=[]):
|
||||
y = deepcopy(x)
|
||||
y.append(1)
|
||||
|
||||
# Use of copy method:
|
||||
|
||||
def flow_through_copy_fp(x=[]):
|
||||
y = x.copy()
|
||||
y.append(1)
|
||||
|
||||
Reference in New Issue
Block a user