Skip to content

Commit

Permalink
Use relevants_from_ad instead of relevants_from_ls
Browse files Browse the repository at this point in the history
  • Loading branch information
karoliineh committed Sep 18, 2023
1 parent a32be38 commit 3879fdc
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions src/analyses/modifiedSinceLongjmp.ml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ struct
(* Only checks for v.vglob on purpose, acessing espaced locals after longjmp is UB like for any local *)
not v.vglob (* *) && not (BaseUtil.is_volatile v) && v.vstorage <> Static

let relevants_from_ls ls =
let relevants_from_ad ls =
(* TODO: what about AD with both known and unknown pointers? *)
if Queries.AD.is_top ls then
VS.top ()
else
Expand All @@ -33,23 +34,12 @@ struct
| _ -> acc
) ls (VS.empty ())

let relevants_from_ad ad =
(* TODO: what about AD with both known and unknown pointers? *)
if Queries.AD.is_top ad then
VS.top ()
else
Queries.AD.fold (fun addr vs ->
match addr with
| Queries.AD.Addr.Addr (v,_) -> if is_relevant v then VS.add v vs else vs
| _ -> vs
) ad (VS.empty ())

(* transfer functions *)
let enter ctx (lval: lval option) (f:fundec) (args:exp list) : (D.t * D.t) list =
[ctx.local, D.bot ()] (* enter with bot as opposed to IdentitySpec *)

let combine_env ctx lval fexp f args fc au (f_ask: Queries.ask) =
let taintedcallee = relevants_from_ls (f_ask.f Queries.MayBeTainted) in
let taintedcallee = relevants_from_ad (f_ask.f Queries.MayBeTainted) in
add_to_all_defined taintedcallee ctx.local

let combine_assign ctx (lval:lval option) fexp (f:fundec) (args:exp list) fc (au:D.t) (f_ask:Queries.ask) : D.t =
Expand Down

0 comments on commit 3879fdc

Please sign in to comment.