Skip to content

Commit c8b5380

Browse files
authored
Merge pull request #1955 from goblint/issue_1934-str-not-an-address
Treat string function non-address inputs as top values
2 parents 3000b6f + 5970771 commit c8b5380

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/analyses/base.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2434,7 +2434,7 @@ struct
24342434
| Addr.Addr (v, o) -> Addr.Addr (v, lo o)
24352435
| other -> other in
24362436
AD.map rmLastOffset a
2437-
| _ -> raise (Failure "String function: not an address")
2437+
| _ -> AD.top ()
24382438
in
24392439
let string_manipulation s1 s2 lv all op_addr op_array =
24402440
let s1_v = eval_rv ~man st s1 in
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// NOCRASH
2+
extern int strcmp(const char *, const char *);
3+
4+
static int hello_read(const char *path) {
5+
return strcmp(path, "Hello");
6+
}
7+
8+
static const struct ops {
9+
int (*read)(const char *);
10+
} hello_oper = {
11+
.read = hello_read,
12+
};
13+
14+
extern int main_real(const struct ops *);
15+
16+
int main() {
17+
return main_real(&hello_oper);
18+
}

0 commit comments

Comments
 (0)