Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simple memcpy/strlen bug #7

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/instance/itvAnalysis.ml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ let inspect_aexp_bo : InterCfg.node -> AlarmExp.t -> Mem.t -> query list -> quer
| Memmove (e1, e2, e3, loc) ->
let v1 = ItvSem.eval (InterCfg.Node.get_pid node) e1 mem in
let v2 = ItvSem.eval (InterCfg.Node.get_pid node) e2 mem in
let e3_1 = Cil.BinOp (Cil.MinusA, e3, Cil.mone, Cil.intType) in
let e3_1 = Cil.BinOp (Cil.MinusA, e3, Cil.one, Cil.intType) in
let v3 = ItvSem.eval (InterCfg.Node.get_pid node) e3_1 mem in
let lst1 = check_bo v1 (Some v3) in
let lst2 = check_bo v2 (Some v3) in
Expand Down
3 changes: 2 additions & 1 deletion src/semantics/itvSem.ml
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,8 @@ let model_strlen mode spec pid (lvo, exps) (mem, global) =
| (Some lv, str::_) ->
let str_val = eval ~spec pid str mem in
let null_pos = ArrayBlk.nullof (ItvDom.Val.array_of_val str_val) in
let v = Val.of_itv (Itv.meet Itv.nat null_pos) in
let offset = ArrayBlk.offsetof (ItvDom.Val.array_of_val str_val) in
let v = Val.of_itv (Itv.meet Itv.nat (Itv.minus null_pos offset)) in
(update mode spec global (eval_lv ~spec pid lv mem) v mem, global)
| _ -> (mem,global)

Expand Down