angr / angr/cle

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

Aberta
#794 1 comentário 0 reações 0 responsáveis Ver no GitHub
Linguagem predominante
Python
Estrelas
485
Forks
135
Merge médio
2d 2h
PRs com merge (30d)
15

Descrição

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.

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.