angr / angr/cle

PE: a section the file does not contain is skipped from the image but still counts toward max_addr

Aperta
#794 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Python
Stelle
485
Fork
135
Merge medio
2g 2h
PR unite (30g)
15

Descrizione

THIS MESSAGE WAS GENERATED BY AN AUTOMATED PROCESS

`PE._get_memory_mapped_image` skips a section whose raw data begins past the end of the file, and logs that it is doing so, while `_register_sections` registers that same section, so it still counts toward `max_addr`. The object ends up declaring a range nothing backs.

On the committed fixture `tests/i386/windows/a94bbeed0ef51db3d3964bb0cc2cbed0adab0e47997d88f34daa92faa1a91e8a`, `ld.main_object.contains_addr(ld.main_object.max_addr)` is True while `ld.find_object_containing` of that same address is None, `describe_addr` calls it "not part of a loaded object", and `ld.memory.load(ld.main_object.sections_map[".rdata"].vaddr, 1)` raises `KeyError`.

That fixture is the one `test_loading_incomplete_pe_file` pins, and #663 already decided a truncated file's missing bytes stay missing. Zero-filling the whole declared extent breaks that test and turns the padding into blocks; backing only the sections the file omits entirely does neither, but still invents bytes.

So either the object should stop claiming addresses it cannot back, or those sections should be zeroed. Neither changes the functions or blocks CFGFast recovers here. Happy to open a pull request for whichever you prefer.

Related: #790.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.