Skip to content

Commit

Permalink
Fix NULL pointer dereference error for NULL mutexattr
Browse files Browse the repository at this point in the history
  • Loading branch information
sim642 committed Apr 5, 2024
1 parent e983b78 commit 430e444
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/analyses/base.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1375,10 +1375,13 @@ struct
| Q.EvalInt e ->
query_evalint ~ctx ctx.local e
| Q.EvalMutexAttr e -> begin
let e:exp = Lval (Cil.mkMem ~addr:e ~off:NoOffset) in
match eval_rv ~ctx ctx.local e with
| MutexAttr a -> a
| v -> MutexAttrDomain.top ()
match eval_rv_address ~ctx ctx.local e with
| Address a ->
begin match get ~ctx ~top:(MutexAttr (MutexAttrDomain.top ())) ctx.local a None with (* ~top corresponds to default NULL *)
| MutexAttr a -> a
| _ -> MutexAttrDomain.top ()
end
| _ -> MutexAttrDomain.top ()
end
| Q.EvalLength e -> begin
match eval_rv_address ~ctx ctx.local e with
Expand Down

0 comments on commit 430e444

Please sign in to comment.