mirror of
https://github.com/morluto/rea.git
synced 2026-11-25 13:48:44 +00:00
* feat(pe): inspect x64 exception-directory function ranges Add inspect_pe_unwind_ranges, a provider-free reader of the PE32+ exception directory (.pdata). It reports each RUNTIME_FUNCTION's begin, end and unwind RVAs, whether the entry starts a function or is a chained fragment (UNW_FLAG_CHAININFO or an indirect unwind RVA), the chain's parent and primary entry, and empty, unsorted, overlapping, unmapped or unresolvable entries as explicit issues. Counts cover every entry while kind, offset and limit select the page. It reads headers through the shared PE image owner without changing its admission. Failures use the existing PE failure projection. Refs #14181 * chore(pe): record the unwind-ranges advertised schema and cursor skill * fix(pe): index chain parents, map the whole exception directory and keep high RVAs unsigned An unsorted table looked up every chain parent with a linear scan, and chain resolution did not yield, so a crafted table could stall the server. Parents are now found through one begin-RVA order and the pass yields to cancellation. The file-backed check covers every declared directory byte, including trailing bytes, and clearing the indirect bit keeps RVAs at or above 0x80000000 unsigned. * fix(pe): bound unwind reads and report unreadable codes, mismatched parents and unsorted overlaps Unwind data is visited in ascending RVA order, so the windowed reader moves forward and reads each region about once whatever the table order. A primary entry whose declared code array leaves the file-backed bytes is unknown (unwind_codes_unmapped), and its header facts are kept. A chain parent must match the whole RUNTIME_FUNCTION; an entry with the same begin but another end or unwind RVA is chain_parent_mismatch. Order and overlap are checked separately. The guide moves under docs/guides/native, and its route is unchanged. * fix(pe): index whole RUNTIME_FUNCTION records for chain parents Entries sharing a begin RVA were scanned for every parent lookup. The table is now ordered once by (begin, end, unwind), and a parent is a binary search for the exact record, with a second search for a begin mismatch. * test(pe): register the unwind-ranges provider lifecycle coverage The provider lifecycle registry needs one entry per provider id. Add rea-pe-unwind-ranges with its public CLI/MCP workflow and a typed resource and cancellation failure test. * test(cli): record inspect-pe-unwind-ranges in the completion goldens * fix(pe): keep a verified unwind report through cleanup failure and check the directory before its allowance A report completed before final close failed was replaced by the file hash. The provider now records the verified report and the shared PE failure projection retains it, as the ELF readers do. The entry allowance now applies only after the directory is shown file-backed, so an oversized count that leaves the file is a malformed target. * chore(pe): register the exception-directory entry allowance as a pending fixed ceiling