Skip to content

Commit

Permalink
Fix offset handling when adding 0 to field offsets
Browse files Browse the repository at this point in the history
  • Loading branch information
karoliineh committed Jan 30, 2025
1 parent fd82abd commit d2840fb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/analyses/base.ml
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ struct
begin match IdxDom.(to_bool (eq f_offset (neg (iDtoIdx n)))) with
| Some true -> `NoOffset
| _ when isArrayType f.ftype -> `Field (f, `Index (n, `NoOffset))
| _ when GobOption.exists (Z.equal Z.zero) (ID.to_int n) -> `NoOffset (* adding (or subtracting) 0 to any type of pointer is ok *)
| _ when GobOption.exists (Z.equal Z.zero) (ID.to_int n) -> `Field (f, `NoOffset) (* adding (or subtracting) 0 to any type of pointer is ok *)
| _ -> raise UnknownPtr (* adding (or subtracting) anything else than 0 to a pointer that is non-indexable will yield an unknown pointer *)
end
| `Index (i, o) ->
Expand Down

0 comments on commit d2840fb

Please sign in to comment.