[PR #2192] [CLOSED] fix(managed): report malformed PE layouts as invalid input #5074

Closed
opened 2026-10-31 01:02:52 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/2192
Author: @takiAA
Created: 10/12/2026
Status: ❌ Closed

Base: main ← Head: fix/managed-pe-input-errors


📝 Commits (1)

  • ce991c1 fix(managed): report malformed PE layouts as invalid input

📊 Changes

3 files changed (+108 additions, -5 deletions)

View changed files

📝 src/dotnet/ManagedStaticProvider.ts (+23 -5)
📝 tests/acceptance/managedCliOutput.test.ts (+50 -0)
📝 tests/boundary/mcp/managedMcp.test.ts (+35 -0)

📄 Description

Summary

Fixes #2191.

A PE section pointing past EOF makes inspect-managed-artifact and inspect-managed-members report execution_failure and recommend rea doctor. The reader already identifies the malformed section, but that diagnostic is lost at the provider boundary.

Map uncaught ManagedReaderFailure errors with code invalid-directory to AnalysisInputError, retaining the reader's message for both CLI and MCP. Errors already represented as partial inspection results stay that way, including native-boundary inspection. Cancellation, cleanup and resource-limit handling are unchanged.

Before / after

Using a generated managed PE with its first section's PointerToRawData set past EOF:

before: execution_failure / "Run rea doctor ..."
after:  invalid_request / path / invalid_format /
        "pe.section-data leaves the artifact byte range"

The compiled CLI regression and MCP regression both fail on unmodified main 5190843f8 and pass with the fix. The CLI test also checks that native-boundary inspection still returns malformed-coverage evidence for the same file.

Validation

macOS arm64, Node 24.18.0 / npm 11.16.0:

  • Focused tests: managedCliOutput, managedMcp, managedStaticProvider, ManagedArtifactFailures, and ManagedDecodeBudget — 25 passed.
  • npm run check — passed, including typecheck, lint, formatting, metadata and architecture guards.
  • npm run verify:managed — 11 portable fixture scenarios passed.
  • npm run verify:test-discovery and git diff --check — passed.

No schema, package or installation changes. Validation used repository-generated PE fixtures; no external managed-application manifest, ILSpy oracle, Windows/Linux execution or full test-suite run.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/2192 **Author:** [@takiAA](https://github.com/takiAA) **Created:** 10/12/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/managed-pe-input-errors` --- ### 📝 Commits (1) - [`ce991c1`](https://github.com/morluto/rea/commit/ce991c1b3656451bd6909515aed8dd4220aee012) fix(managed): report malformed PE layouts as invalid input ### 📊 Changes **3 files changed** (+108 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `src/dotnet/ManagedStaticProvider.ts` (+23 -5) 📝 `tests/acceptance/managedCliOutput.test.ts` (+50 -0) 📝 `tests/boundary/mcp/managedMcp.test.ts` (+35 -0) </details> ### 📄 Description ## Summary Fixes #2191. A PE section pointing past EOF makes `inspect-managed-artifact` and `inspect-managed-members` report `execution_failure` and recommend `rea doctor`. The reader already identifies the malformed section, but that diagnostic is lost at the provider boundary. Map uncaught `ManagedReaderFailure` errors with code `invalid-directory` to `AnalysisInputError`, retaining the reader's message for both CLI and MCP. Errors already represented as partial inspection results stay that way, including native-boundary inspection. Cancellation, cleanup and resource-limit handling are unchanged. ## Before / after Using a generated managed PE with its first section's `PointerToRawData` set past EOF: ```text before: execution_failure / "Run rea doctor ..." after: invalid_request / path / invalid_format / "pe.section-data leaves the artifact byte range" ``` The compiled CLI regression and MCP regression both fail on unmodified main `5190843f8` and pass with the fix. The CLI test also checks that native-boundary inspection still returns malformed-coverage evidence for the same file. ## Validation macOS arm64, Node 24.18.0 / npm 11.16.0: - Focused tests: `managedCliOutput`, `managedMcp`, `managedStaticProvider`, `ManagedArtifactFailures`, and `ManagedDecodeBudget` — 25 passed. - `npm run check` — passed, including typecheck, lint, formatting, metadata and architecture guards. - `npm run verify:managed` — 11 portable fixture scenarios passed. - `npm run verify:test-discovery` and `git diff --check` — passed. No schema, package or installation changes. Validation used repository-generated PE fixtures; no external managed-application manifest, ILSpy oracle, Windows/Linux execution or full test-suite run. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 01:02:52 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#5074
No description provided.