-
Notifications
You must be signed in to change notification settings - Fork 84
Closed
Description
The use of AD.meet to check address set must-not-equality:
Lines 331 to 334 in 3a189a9
| | Eq -> | |
| `Int (if AD.is_bot (AD.meet p1 p2) then ID.of_int ik BI.zero else match eq p1 p2 with Some x when x -> ID.of_int ik BI.one | _ -> bool_top ik) | |
| | Ne -> | |
| `Int (if AD.is_bot (AD.meet p1 p2) then ID.of_int ik BI.one else match eq p1 p2 with Some x when x -> ID.of_int ik BI.zero | _ -> bool_top ik) |
is unsound in at least the following cases:
- First struct field and zero index:
analyzer/tests/regression/02-base/91-ad-meet.c
Lines 6 to 16 in 3a189a9
struct s { int fst; }; int main() { struct s a; void *p = &a.fst; void *q = ((int(*)[1]) (&a))[0]; assert(p == q); return 0; } - Union fields:
analyzer/tests/regression/02-base/92-ad-union-fields.c
Lines 6 to 17 in 3a189a9
union u { int fst; float snd; }; int main() { union u a; void *p = &a.fst; void *q = &a.snd; assert(p == q); return 0; } - Non-first struct field and non-zero index with alignment: Unsound address set must-not-equality check in base #822 (comment).
For both programs we report that the assert definitely fails, but when compiled and run, it succeeds.
Using meet would only work if addresses were represented in their canonical form using a byte offset from the variable.