mirror of
https://codeberg.org/reverse-skill-lab/exe-reverse
synced 2026-11-24 16:04:10 +08:00
Separate an empty slot inventory from a table that holds handles
An empty pair list had two causes and one verdict. When the run never found the import table at all, the report said needs-trace, which sends the reader off to write a trace of the protector's resolver -- the right move for a table full of handles and the wrong move for a table this run simply never located. The misdiagnosis is the expensive kind: it costs a debugger session and it looks like progress. decide_result now returns no-slots when the inventory is empty, and the printed hint says which of the two it is (supply --iat, or reconstruct the table). no-slots exits 1 with needs-trace, because the run did not do the job it was asked to do; the docstring's exit code table says so. The reference gains the matching sentence in the inventory step: an inventory that came back empty is a finding about the run, not a table that holds no addresses. Test: test_no_slot_values_is_its_own_verdict pins both sides -- no slots plus unpaired calls is no-slots, some slots plus unpaired calls is still needs-trace -- and the existing token test now carries a slot count so it cannot pass for the wrong reason.
This commit is contained in:
@@ -155,9 +155,24 @@ def test_a_clean_image_reports_no_pairs(load_script, fixtures):
|
||||
assert mod.decide_result(report, wrote=False) == "no-pairs"
|
||||
|
||||
|
||||
def test_no_slot_values_is_its_own_verdict(load_script):
|
||||
"""A run with nothing to pair against must not send the reader to write a trace.
|
||||
|
||||
Both causes -- a table that holds handles, and a table this run never found -- produce the same
|
||||
empty pair list. The first needs a trace; the second needs --iat. Collapsing them into one token
|
||||
was the first version of this rule.
|
||||
"""
|
||||
mod = load_script("iat_callsite_restore.py")
|
||||
with_no_slots = {"pairs": [], "refused": [], "unpaired": [1], "iat": {"slots": 0, "classes": {}}}
|
||||
assert mod.decide_result(with_no_slots, wrote=False) == "no-slots"
|
||||
with_slots = {"pairs": [], "refused": [], "unpaired": [1],
|
||||
"iat": {"slots": 4, "classes": {}}}
|
||||
assert mod.decide_result(with_slots, wrote=False) == "needs-trace"
|
||||
|
||||
|
||||
def test_result_tokens_follow_the_evidence(load_script):
|
||||
mod = load_script("iat_callsite_restore.py")
|
||||
base = {"pairs": [], "refused": [], "unpaired": [], "iat": {"classes": {}}}
|
||||
base = {"pairs": [], "refused": [], "unpaired": [], "iat": {"slots": 4, "classes": {}}}
|
||||
assert mod.decide_result(dict(base), wrote=False) == "no-pairs"
|
||||
assert mod.decide_result(dict(base, pairs=[1]), wrote=False) == "report-only"
|
||||
assert mod.decide_result(dict(base, pairs=[1]), wrote=True) == "repaired"
|
||||
|
||||
Reference in New Issue
Block a user