Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 06ab671

Browse files
committed
Python points-to. Fix descriptor behviour of Python functions.
1 parent 9d40a6c commit 06ab671

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

python/ql/src/semmle/python/objects/Callables.qll

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,12 @@ class PythonFunctionObjectInternal extends CallableObjectInternal, TPythonFuncti
129129
override boolean isDescriptor() { result = true }
130130

131131
override predicate descriptorGet(ObjectInternal instance, ObjectInternal value, CfgOrigin origin) {
132+
instance.isClass() = false and
132133
value = TBoundMethod(instance, this) and origin = CfgOrigin::unknown()
134+
or
135+
any(ObjectInternal obj).binds(instance, _, this) and
136+
instance.isClass() = true and
137+
value = this and origin = CfgOrigin::fromCfgNode(this.getOrigin())
133138
}
134139

135140
override CallNode getACall(PointsToContext ctx) {

0 commit comments

Comments
 (0)