Skip to content

Commit 425e3e8

Browse files
Merge pull request #1405 from goblint/issue_1386
Improve output for `NullByte`
2 parents cf85b91 + 82e11db commit 425e3e8

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

src/cdomain/value/cdomains/arrayDomain.ml

+13-2
Original file line numberDiff line numberDiff line change
@@ -1012,9 +1012,9 @@ struct
10121012
let (+.) = Z.add
10131013

10141014
(* (Must Null Set, May Null Set, Array Size) *)
1015-
include Lattice.Prod (Nulls) (Idx)
1015+
include Lattice.Prod (Nulls) (struct include Idx let name () = "length" end)
10161016

1017-
let name () = "arrays containing null bytes"
1017+
let name () = "ArrayNullBytes"
10181018
type idx = Idx.t
10191019
type value = Val.t
10201020

@@ -1815,6 +1815,17 @@ struct
18151815
else
18161816
f_get
18171817

1818+
let delegate_if_no_nullbytes (a, n) ffull fa =
1819+
if get_bool "ana.base.arrays.nullbytes" then
1820+
ffull (a, n)
1821+
else
1822+
fa a
1823+
1824+
let show x = delegate_if_no_nullbytes x show A.show
1825+
let printXml f x = delegate_if_no_nullbytes x (printXml f) (A.printXml f)
1826+
let to_yojson x = delegate_if_no_nullbytes x to_yojson A.to_yojson
1827+
let pretty () x = delegate_if_no_nullbytes x (pretty ()) (A.pretty ())
1828+
18181829
let construct a n =
18191830
if get_bool "ana.base.arrays.nullbytes" then
18201831
(a, n ())

src/cdomain/value/cdomains/nullByteSet.ml

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ module MustSet = struct
44
module M = SetDomain.Reverse (SetDomain.ToppedSet (IntOps.BigIntOps) (struct let topname = "All Null" end))
55
include M
66

7+
let name () = "MustNullBytes"
8+
79
let compute_set len =
810
List.init (Z.to_int len) Z.of_int
911
|> of_list
@@ -48,6 +50,8 @@ module MaySet = struct
4850
module M = SetDomain.ToppedSet (IntOps.BigIntOps) (struct let topname = "All Null" end)
4951
include M
5052

53+
let name () = "MayNullBytes"
54+
5155
let elements ?max_size may_nulls_set =
5256
if M.is_top may_nulls_set then
5357
match max_size with

0 commit comments

Comments
 (0)