Skip to content

Commit 022a9bc

Browse files
affeq: Fix array OOB in invariant
1 parent eade39e commit 022a9bc

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/cdomains/apron/affineEqualityDomain.apron.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,7 @@ struct
681681
let invariant t =
682682
let invariant m =
683683
let earray = Lincons1.array_make t.env (Matrix.num_rows m) in
684-
for i = 0 to Lincons1.array_length earray do
684+
for i = 0 to (Lincons1.array_length earray -1) do
685685
let row = Matrix.get_row m i in
686686
let coeff_vars = List.map (fun x -> Coeff.s_of_mpqf @@ Vector.nth row (Environment.dim_of_var t.env x), x) (vars t) in
687687
let cst = Coeff.s_of_mpqf @@ Vector.nth row (Vector.length row - 1) in
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//SKIP PARAM: --set ana.activated[+] affeq --set sem.int.signed_overflow assume_none --set ana.relation.privatization top --enable witness.yaml.enabled
2+
// Identical to Example 63/01; additionally checking that writing out witnesses does not crash the analyzer
3+
#include <goblint.h>
4+
5+
void main(void) {
6+
int i;
7+
int j;
8+
int k;
9+
i = 2;
10+
j = k + 5;
11+
12+
while (i < 100) {
13+
__goblint_check(3 * i - j + k == 1);
14+
i = i + 1;
15+
j = j + 3;
16+
}
17+
__goblint_check(3 * i - j + k == 1);
18+
}

0 commit comments

Comments
 (0)