@@ -92,36 +92,36 @@ predicate referenceTo(Expr source, Expr use) {
92
92
)
93
93
}
94
94
95
- from FunctionCall fc , Expr check , Expr checkUse , Expr opUse
95
+ from Expr check , Expr checkPath , FunctionCall use , Expr usePath
96
96
where
97
- // checkUse looks like a check on a filename
97
+ // `check` looks like a check on a filename
98
98
(
99
99
// either:
100
100
// an access check
101
- check = accessCheck ( checkUse )
101
+ check = accessCheck ( checkPath )
102
102
or
103
103
// a stat
104
- check = stat ( checkUse , _)
104
+ check = stat ( checkPath , _)
105
105
or
106
106
// another filename operation (null pointers can indicate errors)
107
- check = filenameOperation ( checkUse )
107
+ check = filenameOperation ( checkPath )
108
108
or
109
109
// access to a member variable on the stat buf
110
110
// (morally, this should be a use-use pair, but it seems unlikely
111
111
// that this variable will get reused in practice)
112
- exists ( Variable buf | exists ( stat ( checkUse , buf .getAnAccess ( ) ) ) |
112
+ exists ( Variable buf | exists ( stat ( checkPath , buf .getAnAccess ( ) ) ) |
113
113
check .( VariableAccess ) .getQualifier ( ) = buf .getAnAccess ( )
114
114
)
115
115
) and
116
- // checkUse and opUse refer to the same SSA variable
117
- exists ( SsaDefinition def , StackVariable v | def .getAUse ( v ) = checkUse and def .getAUse ( v ) = opUse ) and
118
- // opUse looks like an operation on a filename
119
- fc = filenameOperation ( opUse ) and
120
- // the return value of check is used (possibly with one step of
121
- // variable indirection) in a guard which controls fc
116
+ // `checkPath` and `usePath` refer to the same SSA variable
117
+ exists ( SsaDefinition def , StackVariable v | def .getAUse ( v ) = checkPath and def .getAUse ( v ) = usePath ) and
118
+ // `op` looks like an operation on a filename
119
+ use = filenameOperation ( usePath ) and
120
+ // the return value of ` check` is used (possibly with one step of
121
+ // variable indirection) in a guard which controls `use`
122
122
exists ( GuardCondition guard | referenceTo ( check , guard .getAChild * ( ) ) |
123
- guard .controls ( fc .( ControlFlowNode ) .getBasicBlock ( ) , _)
123
+ guard .controls ( use .( ControlFlowNode ) .getBasicBlock ( ) , _)
124
124
)
125
- select fc ,
125
+ select use ,
126
126
"The $@ being operated upon was previously $@, but the underlying file may have been changed since then." ,
127
- opUse , "filename" , check , "checked"
127
+ usePath , "filename" , check , "checked"
0 commit comments