From 15e6c3d636bde630a5df20d31af2c812355b68a2 Mon Sep 17 00:00:00 2001 From: Simmo Saan Date: Mon, 2 Oct 2023 10:37:21 +0300 Subject: [PATCH] Simplify is_not_heap_alloc_var and add TODO --- src/analyses/base.ml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/analyses/base.ml b/src/analyses/base.ml index 6442ed4f8a..ea595ad96d 100644 --- a/src/analyses/base.ml +++ b/src/analyses/base.ml @@ -1123,7 +1123,8 @@ struct (* interpreter end *) let is_not_heap_alloc_var ctx v = - (not (ctx.ask (Queries.IsAllocVar v))) || (ctx.ask (Queries.IsAllocVar v) && not (ctx.ask (Queries.IsHeapVar v))) + let is_alloc = ctx.ask (Queries.IsAllocVar v) in + not is_alloc || (is_alloc && not (ctx.ask (Queries.IsHeapVar v))) let query_invariant ctx context = let cpa = ctx.local.BaseDomain.cpa in @@ -2114,7 +2115,7 @@ struct let dest_a, dest_typ = addr_type_of_exp dest in let value = VD.zero_init_value dest_typ in set ~ctx (Analyses.ask_of_ctx ctx) gs st dest_a dest_typ value - | Memcpy { dest = dst; src; n; }, _ -> + | Memcpy { dest = dst; src; n; }, _ -> (* TODO: use n *) memory_copying dst src (* strcpy(dest, src); *) | Strcpy { dest = dst; src; n = None }, _ ->