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

Skip to content

Commit 1519e1b

Browse files
committed
Python: Make sanity check context sensitive.
1 parent f5e419e commit 1519e1b

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

python/ql/src/analysis/Sanity.ql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,14 +162,14 @@ predicate function_object_sanity(string clsname, string problem, string what) {
162162

163163
predicate multiple_origins_per_object(Object obj) {
164164
not obj.isC() and not obj instanceof ModuleObject and
165-
exists(ControlFlowNode use | strictcount(ControlFlowNode orig | use.refersTo(obj, orig)) > 1)
165+
exists(ControlFlowNode use, Context ctx | strictcount(ControlFlowNode orig | use.refersTo(ctx, obj, _, orig)) > 1)
166166
}
167167

168168
predicate intermediate_origins(ControlFlowNode use, ControlFlowNode inter, Object obj) {
169-
exists(ControlFlowNode orig |
169+
exists(ControlFlowNode orig, Context ctx |
170170
not inter = orig |
171-
use.refersTo(obj, inter) and
172-
inter.refersTo(obj, orig) and
171+
use.refersTo(ctx, obj, _, inter) and
172+
inter.refersTo(ctx, obj, _, orig) and
173173
// It can sometimes happen that two different modules (e.g. cPickle and Pickle)
174174
// have the same attribute, but different origins.
175175
not strictcount(Object val | inter.(AttrNode).getObject().refersTo(val)) > 1

0 commit comments

Comments
 (0)