Skip to content

Commit

Permalink
Add TODOs related to null byte array domain
Browse files Browse the repository at this point in the history
  • Loading branch information
sim642 committed Dec 11, 2023
1 parent 77b4f67 commit f2fdb62
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/analyses/base.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2191,6 +2191,7 @@ struct
in
let address_from_value (v:value) = match v with
| Address a ->
(* TODO: is it fine to just drop the last index unconditionally? https://github.com/goblint/analyzer/pull/1076#discussion_r1408975611 *)
let rec lo = function
| `Index (i, `NoOffset) -> `NoOffset
| `NoOffset -> `NoOffset
Expand All @@ -2210,6 +2211,7 @@ struct
let s2_a = address_from_value s2_v in
let s2_typ = AD.type_of s2_a in
(* compute value in string literals domain if s1 and s2 are both string literals *)
(* TODO: is this reliable? there could be a char* which isn't StrPtr *)
if CilType.Typ.equal s1_typ charPtrType && CilType.Typ.equal s2_typ charPtrType then
begin match lv, op_addr with
| Some lv_val, Some f ->
Expand Down Expand Up @@ -2304,7 +2306,8 @@ struct
let a = address_from_value v in
let value:value =
(* if s string literal, compute strlen in string literals domain *)
if AD.type_of a = charPtrType then
(* TODO: is this reliable? there could be a char* which isn't StrPtr *)
if CilType.Typ.equal (AD.type_of a) charPtrType then
Int (AD.to_string_length a)
(* else compute strlen in array domain *)
else
Expand Down
1 change: 1 addition & 0 deletions src/cdomains/valueDomain.ml
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,7 @@ struct
| _, Bot -> Bot (* Leave uninitialized value (from malloc) alone in free to avoid trashing everything. TODO: sound? *)
| t , _ -> top_value t

(* TODO: why is this separately needed? *)
let rec invalidate_abstract_value = function
| Top -> Top
| Int i -> Int (ID.top_of (ID.ikind i))
Expand Down

0 comments on commit f2fdb62

Please sign in to comment.