@@ -105,14 +105,14 @@ private module SizeBarrier {
105
105
}
106
106
107
107
/**
108
- * Holds if `left < right + k` holds if `g` evaluates to `testIsTrue`.
108
+ * Holds if `left <= right + k` holds if `g` evaluates to `testIsTrue`.
109
109
*/
110
110
additional predicate isSink (
111
111
DataFlow:: Node left , DataFlow:: Node right , IRGuardCondition g , int k , boolean testIsTrue
112
112
) {
113
113
// The sink is any "large" side of a relational comparison. i.e., the `right` expression
114
- // in a guard such as `left < right + k`.
115
- g .comparesLt ( left .asOperand ( ) , right .asOperand ( ) , k , true , testIsTrue )
114
+ // in a guard such as `left <= right + k`.
115
+ g .comparesLt ( left .asOperand ( ) , right .asOperand ( ) , k + 1 , true , testIsTrue )
116
116
}
117
117
118
118
predicate isSink ( DataFlow:: Node sink ) { isSink ( _, sink , _, _, _) }
@@ -123,12 +123,12 @@ private module SizeBarrier {
123
123
private int getAFlowStateForNode ( DataFlow:: Node node ) {
124
124
exists ( DataFlow:: Node source |
125
125
flow ( source , node ) and
126
- hasSize ( _, source , result )
126
+ hasSize ( _, source , result + 1 )
127
127
)
128
128
}
129
129
130
130
/**
131
- * Holds if `left < nRight + k` holds if `g` evaluates to `edge`.
131
+ * Holds if `left <= nRight + k` holds if `g` evaluates to `edge`.
132
132
*/
133
133
private predicate operandGuardChecks (
134
134
IRGuardCondition g , Operand left , DataFlow:: Node right , int k , boolean edge
@@ -152,10 +152,10 @@ private module SizeBarrier {
152
152
// result <= value + delta (by 1.)
153
153
// <= right + k + delta (by 2.)
154
154
operandGuardChecks ( pragma [ only_bind_into ] ( g ) , pragma [ only_bind_into ] ( left ) , right ,
155
- pragma [ only_bind_into ] ( k + 1 ) , pragma [ only_bind_into ] ( edge ) ) and
155
+ pragma [ only_bind_into ] ( k ) , pragma [ only_bind_into ] ( edge ) ) and
156
156
bounded ( result , value .getAnInstruction ( ) , delta ) and
157
157
g .controls ( result .getBlock ( ) , edge ) and
158
- k + 1 <= getAFlowStateForNode ( right )
158
+ k <= getAFlowStateForNode ( right )
159
159
)
160
160
}
161
161
0 commit comments