Skip to content

Commit

Permalink
One less May/MustSet
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-schwarz committed Nov 28, 2023
1 parent c85bad9 commit 20ee375
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/cdomains/arrayDomain.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1395,14 +1395,11 @@ struct
(if min_size1 <. min_len2 then
warn_past_end "The length of string src may be greater than the allocated size for dest");
(* do not keep any index of dest as no maximal strlen of src *)
let must_nulls_set_result =
let min_size2 = BatOption.default Z.zero (Idx.minimal truncatedsize) in
MustSet.filter ~min_size:min_size2 (Z.gt min_size1) must_nulls_set2' in
let may_nulls_set_result =
(* get all may nulls from src string as no maximal size of dest *)
may_nulls_set2'
|> MaySet.union (MaySet.filter ~max_size:(Z.succ min_len2) (Z.leq min_len2) may_nulls_set1) in
((must_nulls_set_result, may_nulls_set_result), dstsize)
let min_size2 = BatOption.default Z.zero (Idx.minimal truncatedsize) in
let truncatednulls = Nulls.remove_interval Possibly (Z.zero, min_size1) min_size2 truncatednulls in
let filtered_dst = Nulls.filter ~max_size:(Z.succ min_len2) (Z.leq min_len2) dstnulls in
(* get all may nulls from src string as no maximal size of dest *)
(Nulls.union_mays truncatednulls filtered_dst, dstsize)
(* any other case shouldn't happen as minimal index is always >= 0 *)
| _ -> (Nulls.top (), dstsize) in

Expand Down
2 changes: 2 additions & 0 deletions src/cdomains/nullByteSet.ml
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ module MustMaySet = struct
| Definitely ->failwith "todo"
| Possibly -> MaySet.elements ?max_size mays

let union_mays (must,mays) (_,mays2) = (must, MaySet.join mays mays2)


let precise_singleton i =
(MustSet.singleton i, MaySet.singleton i)
Expand Down

0 comments on commit 20ee375

Please sign in to comment.