|
|
@ -291,8 +291,8 @@ module Exec = struct
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
module Check = struct
|
|
|
|
module Check = struct
|
|
|
|
let check_access ~size ~idx ~size_sym_exp ~idx_sym_exp ~relation ~arr ~idx_traces
|
|
|
|
let check_access ~size ~idx ~size_sym_exp ~idx_sym_exp ~relation ~arr ~idx_traces ~last_included
|
|
|
|
?(is_collection_add = false) location cond_set =
|
|
|
|
location cond_set =
|
|
|
|
match (size, idx) with
|
|
|
|
match (size, idx) with
|
|
|
|
| NonBottom length, NonBottom idx ->
|
|
|
|
| NonBottom length, NonBottom idx ->
|
|
|
|
let offset =
|
|
|
|
let offset =
|
|
|
@ -305,12 +305,12 @@ module Check = struct
|
|
|
|
in
|
|
|
|
in
|
|
|
|
let arr_traces = Dom.Val.get_traces arr in
|
|
|
|
let arr_traces = Dom.Val.get_traces arr in
|
|
|
|
PO.ConditionSet.add_array_access location ~size:length ~offset ~idx ~size_sym_exp
|
|
|
|
PO.ConditionSet.add_array_access location ~size:length ~offset ~idx ~size_sym_exp
|
|
|
|
~idx_sym_exp ~relation ~is_collection_add ~idx_traces ~arr_traces cond_set
|
|
|
|
~idx_sym_exp ~relation ~last_included ~idx_traces ~arr_traces cond_set
|
|
|
|
| _ ->
|
|
|
|
| _ ->
|
|
|
|
cond_set
|
|
|
|
cond_set
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let array_access ~arr ~idx ~idx_sym_exp ~relation ~is_plus location cond_set =
|
|
|
|
let array_access ~arr ~idx ~idx_sym_exp ~relation ~is_plus ~last_included location cond_set =
|
|
|
|
let arr_blk = Dom.Val.get_array_blk arr in
|
|
|
|
let arr_blk = Dom.Val.get_array_blk arr in
|
|
|
|
let size = ArrayBlk.sizeof arr_blk in
|
|
|
|
let size = ArrayBlk.sizeof arr_blk in
|
|
|
|
let size_sym_exp = Relation.SymExp.of_sym (Dom.Val.get_size_sym arr) in
|
|
|
|
let size_sym_exp = Relation.SymExp.of_sym (Dom.Val.get_size_sym arr) in
|
|
|
@ -326,11 +326,12 @@ module Check = struct
|
|
|
|
L.(debug BufferOverrun Verbose)
|
|
|
|
L.(debug BufferOverrun Verbose)
|
|
|
|
"@[<v 2>Add condition :@,array: %a@, idx: %a + %a@,@]@." ArrayBlk.pp arr_blk Itv.pp
|
|
|
|
"@[<v 2>Add condition :@,array: %a@, idx: %a + %a@,@]@." ArrayBlk.pp arr_blk Itv.pp
|
|
|
|
(ArrayBlk.offsetof arr_blk) Itv.pp idx ;
|
|
|
|
(ArrayBlk.offsetof arr_blk) Itv.pp idx ;
|
|
|
|
check_access ~size ~idx ~size_sym_exp ~idx_sym_exp ~relation ~arr ~idx_traces location cond_set
|
|
|
|
check_access ~size ~idx ~size_sym_exp ~idx_sym_exp ~relation ~arr ~idx_traces ~last_included
|
|
|
|
|
|
|
|
location cond_set
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let collection_access integer_type_widths ~array_exp ~index_exp ?(is_collection_add = false) mem
|
|
|
|
let collection_access integer_type_widths ~array_exp ~index_exp ~last_included mem location
|
|
|
|
location cond_set =
|
|
|
|
cond_set =
|
|
|
|
let idx = Sem.eval integer_type_widths index_exp mem in
|
|
|
|
let idx = Sem.eval integer_type_widths index_exp mem in
|
|
|
|
let arr = Sem.eval integer_type_widths array_exp mem in
|
|
|
|
let arr = Sem.eval integer_type_widths array_exp mem in
|
|
|
|
let idx_traces = Dom.Val.get_traces idx in
|
|
|
|
let idx_traces = Dom.Val.get_traces idx in
|
|
|
@ -338,20 +339,20 @@ module Check = struct
|
|
|
|
let idx = Dom.Val.get_itv idx in
|
|
|
|
let idx = Dom.Val.get_itv idx in
|
|
|
|
let relation = Dom.Mem.get_relation mem in
|
|
|
|
let relation = Dom.Mem.get_relation mem in
|
|
|
|
check_access ~size ~idx ~size_sym_exp:None ~idx_sym_exp:None ~relation ~arr ~idx_traces
|
|
|
|
check_access ~size ~idx ~size_sym_exp:None ~idx_sym_exp:None ~relation ~arr ~idx_traces
|
|
|
|
~is_collection_add location cond_set
|
|
|
|
~last_included location cond_set
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let lindex integer_type_widths ~array_exp ~index_exp mem location cond_set =
|
|
|
|
let lindex integer_type_widths ~array_exp ~index_exp ~last_included mem location cond_set =
|
|
|
|
let idx = Sem.eval integer_type_widths index_exp mem in
|
|
|
|
let idx = Sem.eval integer_type_widths index_exp mem in
|
|
|
|
let arr = Sem.eval_arr integer_type_widths array_exp mem in
|
|
|
|
let arr = Sem.eval_arr integer_type_widths array_exp mem in
|
|
|
|
let idx_sym_exp =
|
|
|
|
let idx_sym_exp =
|
|
|
|
Relation.SymExp.of_exp ~get_sym_f:(Sem.get_sym_f integer_type_widths mem) index_exp
|
|
|
|
Relation.SymExp.of_exp ~get_sym_f:(Sem.get_sym_f integer_type_widths mem) index_exp
|
|
|
|
in
|
|
|
|
in
|
|
|
|
let relation = Dom.Mem.get_relation mem in
|
|
|
|
let relation = Dom.Mem.get_relation mem in
|
|
|
|
array_access ~arr ~idx ~idx_sym_exp ~relation ~is_plus:true location cond_set
|
|
|
|
array_access ~arr ~idx ~idx_sym_exp ~relation ~is_plus:true ~last_included location cond_set
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let array_access_byte ~arr ~idx ~relation ~is_plus location cond_set =
|
|
|
|
let array_access_byte ~arr ~idx ~relation ~is_plus ~last_included location cond_set =
|
|
|
|
let arr_blk = Dom.Val.get_array_blk arr in
|
|
|
|
let arr_blk = Dom.Val.get_array_blk arr in
|
|
|
|
let size = ArrayBlk.sizeof_byte arr_blk in
|
|
|
|
let size = ArrayBlk.sizeof_byte arr_blk in
|
|
|
|
let idx_itv = Dom.Val.get_itv idx in
|
|
|
|
let idx_itv = Dom.Val.get_itv idx in
|
|
|
@ -361,14 +362,15 @@ module Check = struct
|
|
|
|
"@[<v 2>Add condition :@,array: %a@, idx: %a + %a@,@]@." ArrayBlk.pp arr_blk Itv.pp
|
|
|
|
"@[<v 2>Add condition :@,array: %a@, idx: %a + %a@,@]@." ArrayBlk.pp arr_blk Itv.pp
|
|
|
|
(ArrayBlk.offsetof arr_blk) Itv.pp idx ;
|
|
|
|
(ArrayBlk.offsetof arr_blk) Itv.pp idx ;
|
|
|
|
check_access ~size ~idx ~size_sym_exp:None ~idx_sym_exp:None ~relation ~arr ~idx_traces
|
|
|
|
check_access ~size ~idx ~size_sym_exp:None ~idx_sym_exp:None ~relation ~arr ~idx_traces
|
|
|
|
location cond_set ~is_collection_add:true
|
|
|
|
~last_included location cond_set
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let lindex_byte integer_type_widths ~array_exp ~byte_index_exp mem location cond_set =
|
|
|
|
let lindex_byte integer_type_widths ~array_exp ~byte_index_exp ~last_included mem location
|
|
|
|
|
|
|
|
cond_set =
|
|
|
|
let idx = Sem.eval integer_type_widths byte_index_exp mem in
|
|
|
|
let idx = Sem.eval integer_type_widths byte_index_exp mem in
|
|
|
|
let arr = Sem.eval_arr integer_type_widths array_exp mem in
|
|
|
|
let arr = Sem.eval_arr integer_type_widths array_exp mem in
|
|
|
|
let relation = Dom.Mem.get_relation mem in
|
|
|
|
let relation = Dom.Mem.get_relation mem in
|
|
|
|
array_access_byte ~arr ~idx ~relation ~is_plus:true location cond_set
|
|
|
|
array_access_byte ~arr ~idx ~relation ~is_plus:true ~last_included location cond_set
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let binary_operation integer_type_widths bop ~lhs ~rhs location cond_set =
|
|
|
|
let binary_operation integer_type_widths bop ~lhs ~rhs location cond_set =
|
|
|
|