Skip to content

Conversation

gitoleg
Copy link
Contributor

@gitoleg gitoleg commented May 20, 2020

Bil.Eval still relies on the assumption that memory can address only values of 1-byte length. And once the stored/loaded value size differs from memory value size, we try to simplify an expression. But the simplification in its turn can leave an expression unchanged since it takes into account both memory value size and size of a stored/loaded value. And that's how we get an infinite loop: since an expression is unchanged, we try to eval it again, simplify, and so on.

This PR fixes this problem and checks both the size of the stored/loaded value and memory value size.

fixes #848

Bil.Eval still relies on the assumption that memory can address only values of 1 byte length. And once the stored/loaded value size
differs from memory value size, we try to simplify an expression. But the simplification in its turn can leave an expression unchanged
since it takes into account both memory value size and size of a stored/loaded value. And that's how we get an infinite loop: since an expression is unchanged, we try to eval it again, simplify, and so on.
This PR fixes this problem and checks both the size of stored/loaded value and memory value size.
@gitoleg gitoleg requested a review from ivg May 20, 2020 16:21

method eval_load ~mem ~addr endian sz =
if Size.(sz <> `r8)
if Size.(sz <> infer_value_size mem)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

infer_value_size shall not raise, instead self#type_error TE.bad_mem should be called if mem is not of type Mem.

@gitoleg gitoleg changed the title fixes BIl.eval memory operations for different sizes of values fixes BIL.eval memory operations for different sizes of values May 20, 2020
@gitoleg gitoleg changed the title fixes BIL.eval memory operations for different sizes of values fixes Bil.eval memory operations for different sizes of values May 20, 2020
@ivg ivg merged commit 09f1aef into BinaryAnalysisPlatform:master May 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bil Store Eval behaves badly
2 participants