Skip to content

Commit 4be6a4f

Browse files
committed
Fix spurious * overflow check in calloc implementation
1 parent c8151c3 commit 4be6a4f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/analyses/base.ml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2763,7 +2763,10 @@ struct
27632763
let blob_set = Option.map_default (fun heap_var -> [heap_var, TVoid [], VD.Blob (VD.bot (), sizeval, ZeroInit.calloc)]) [] heap_var in
27642764
set_many ~man st ((eval_lv ~man st lv, (Cilfacade.typeOfLval lv), Address addr):: blob_set)
27652765
else
2766-
let blobsize = ID.mul (ID.cast_to ~kind:Internal ik @@ sizeval) (ID.cast_to ~kind:Internal ik @@ countval) in (* TODO: proper castkind *)
2766+
let blobsize = (* only speculative during ID.mul *)
2767+
let@ () = GobRef.wrap AnalysisState.executing_speculative_computations true in
2768+
ID.mul (ID.cast_to ~kind:Internal ik @@ sizeval) (ID.cast_to ~kind:Internal ik @@ countval) (* TODO: proper castkind *)
2769+
in
27672770
let offset = `Index (IdxDom.of_int (Cilfacade.ptrdiff_ikind ()) Z.zero, `NoOffset) in
27682771
(* the heap_var is the base address of the allocated memory, but we need to keep track of the offset for the blob *)
27692772
let addr_offset = AD.map (fun a -> Addr.add_offset a offset) addr in

0 commit comments

Comments
 (0)