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

fixes two bugs in the Memory module #1272

Merged
merged 1 commit into from
Feb 22, 2021

Conversation

ivg
Copy link
Member

@ivg ivg commented Feb 22, 2021

The first bug was breaking the raw loader at least. It bug was
introduced in #1178 during the Memory.view optimization. A check was
missed that allowed for creation of invalid views. The invalid views
later were caught with an assertion check, (easily reproduced with
bap /bin/ls --loader=raw), e.g.,

("Assert_failure bap_memory.ml:72:2"
  "Raised at file \"bap_memory.ml\", line 72, characters 2-31\
 \nCalled from file \"bap_memory.ml\", line 196, characters 2-18\
 \nCalled from file \"bap_memory.ml\", line 410, characters 26-52\
 \nCalled from file \"bap_trie.ml\", line 46, characters 34-53\
 \nCalled from file \"bap_trie.ml\", line 62, characters 4-130\
 \nCalled from file \"bap_byteweight.ml\", line 78, characters 12-39\
 \nCalled from file \"bap_byteweight.ml\", line 129, characters 12-39\
 \nCalled from file \"byteweight_main.ml\", line 50, characters 44-56\
 \nCalled from file \"src/sequence.ml\", line 123, characters 29-36\
 \nCalled from file \"byteweight_main.ml\" (inlined), line 49, characters 4-116\
 \nCalled from file \"byteweight_main.ml\", line 48, characters 4-146\
...

The second bug was probably all the time in the library and concerns
Memory.find_map and Memory.find_if, which are talking an optional
word_size parameter that was ignored and functions were always
iterating over bytes.

The first bug was breaking the raw loader at least. It bug was
introduced in BinaryAnalysisPlatform#1178 during the `Memory.view` optimization. A check was
missed that allowed for creation of invalid views. The invalid views
later were caught with an assertion check, (easily reproduced with
`bap /bin/ls --loader=raw`), e.g.,

```
("Assert_failure bap_memory.ml:72:2"
  "Raised at file \"bap_memory.ml\", line 72, characters 2-31\
 \nCalled from file \"bap_memory.ml\", line 196, characters 2-18\
 \nCalled from file \"bap_memory.ml\", line 410, characters 26-52\
 \nCalled from file \"bap_trie.ml\", line 46, characters 34-53\
 \nCalled from file \"bap_trie.ml\", line 62, characters 4-130\
 \nCalled from file \"bap_byteweight.ml\", line 78, characters 12-39\
 \nCalled from file \"bap_byteweight.ml\", line 129, characters 12-39\
 \nCalled from file \"byteweight_main.ml\", line 50, characters 44-56\
 \nCalled from file \"src/sequence.ml\", line 123, characters 29-36\
 \nCalled from file \"byteweight_main.ml\" (inlined), line 49, characters 4-116\
 \nCalled from file \"byteweight_main.ml\", line 48, characters 4-146\
...
```

The second bug was probably all the time in the library and concerns
`Memory.find_map` and `Memory.find_if`, which are talking an optional
`word_size` parameter that was ignored and functions were always
iterating over bytes.
@ivg ivg merged commit b7fd489 into BinaryAnalysisPlatform:master Feb 22, 2021
@ivg ivg deleted the memory-module-bug-fixes branch December 1, 2021 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant