[PR #5358] [CLOSED] fix(go): read metadata when PE virtual size is zero #6894

Closed
opened 2026-11-01 21:43:53 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/5358
Author: @adipatel399
Created: 10/20/2026
Status: ❌ Closed

Base: main ← Head: fix/go-pe-metadata


📝 Commits (1)

  • 12f79f7 fix(go): read metadata when PE virtual size is zero

📊 Changes

3 files changed (+73 additions, -1 deletions)

View changed files

📝 src/go/GoPeImage.ts (+1 -1)
📝 tests/acceptance/goBinaryCli.test.ts (+43 -0)
📝 tests/boundary/go/goBinaryImage.test.ts (+29 -0)

📄 Description

Summary

Fixes #5333.

Go metadata was reported as absent in PE files whose data section has zero VirtualSize and nonzero SizeOfRawData. Discovery now uses the same content size as section inspection, so these files retain their compiler version, module records, build settings and original source locations.

Problem and expected behavior

The section reader already falls back to raw size when VirtualSize is zero. The metadata search used a separate minimum calculation that reduced the search range to zero. Both paths should interpret the same section consistently.

Change and scope

Reuse the existing contentSize for the metadata search. A nonzero VirtualSize still bounds discovery and excludes raw alignment padding. This is a correction within existing static inspection behavior; a separate maintainer scope decision is not applicable.

Contract and boundary impact

The semantic owner is the Go PE section reader, before build information discovery. CLI and MCP schemas are unchanged. The correction covers PE32 and PE32+ with inline and pointer encodings. Evidence keeps the supplied artifact digest and original byte locations. There are no target execution, mutation, installation, package or generated metadata changes.

Evidence and regression coverage

The four new reader regressions failed on the original implementation with null build information. All pass with the correction. Two additional cases confirm that metadata in padding beyond a nonzero virtual size remains undiscovered.

Compiled CLI and stdio MCP cases compare ordinary and zero VirtualSize fixtures for all four format and encoding combinations. Both return go_version: "go1.26.0" and identical build information, including parsed module records and source locations. Each artifact retains its own digest, and the MCP result matches the CLI result.

Validation performed

The focused Go reader, provider, CLI and MCP suites passed: 152 tests across four files.

npm run check passed, including type checking, lint, formatting, unused code checks, package metadata and architecture guards. Lint reported zero errors and 1799 warnings across the repository.

npm run verify:test-discovery passed with all 1714 test files discovered exactly once. git diff --check passed.

Compatibility, safety, and release

Validation ran on macOS arm64 with Node 24.18.0 and npm 11.16.0. Fixtures are synthetic PE files and were never executed. Windows execution and compiler produced binaries were not tested. No external analysis engine is required for this reader. No breaking changes or migration steps.

Author readiness

Human owner: @adipatel399

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

🔄 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/5358 **Author:** [@adipatel399](https://github.com/adipatel399) **Created:** 10/20/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/go-pe-metadata` --- ### 📝 Commits (1) - [`12f79f7`](https://github.com/morluto/rea/commit/12f79f7e69da91cf428d5fa4a0d5ad241fca5d00) fix(go): read metadata when PE virtual size is zero ### 📊 Changes **3 files changed** (+73 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `src/go/GoPeImage.ts` (+1 -1) 📝 `tests/acceptance/goBinaryCli.test.ts` (+43 -0) 📝 `tests/boundary/go/goBinaryImage.test.ts` (+29 -0) </details> ### 📄 Description ## Summary Fixes #5333. Go metadata was reported as absent in PE files whose data section has zero VirtualSize and nonzero SizeOfRawData. Discovery now uses the same content size as section inspection, so these files retain their compiler version, module records, build settings and original source locations. ## Problem and expected behavior The section reader already falls back to raw size when VirtualSize is zero. The metadata search used a separate minimum calculation that reduced the search range to zero. Both paths should interpret the same section consistently. ## Change and scope Reuse the existing contentSize for the metadata search. A nonzero VirtualSize still bounds discovery and excludes raw alignment padding. This is a correction within existing static inspection behavior; a separate maintainer scope decision is not applicable. ## Contract and boundary impact The semantic owner is the Go PE section reader, before build information discovery. CLI and MCP schemas are unchanged. The correction covers PE32 and PE32+ with inline and pointer encodings. Evidence keeps the supplied artifact digest and original byte locations. There are no target execution, mutation, installation, package or generated metadata changes. ## Evidence and regression coverage The four new reader regressions failed on the original implementation with null build information. All pass with the correction. Two additional cases confirm that metadata in padding beyond a nonzero virtual size remains undiscovered. Compiled CLI and stdio MCP cases compare ordinary and zero VirtualSize fixtures for all four format and encoding combinations. Both return go_version: "go1.26.0" and identical build information, including parsed module records and source locations. Each artifact retains its own digest, and the MCP result matches the CLI result. ## Validation performed The focused Go reader, provider, CLI and MCP suites passed: 152 tests across four files. `npm run check` passed, including type checking, lint, formatting, unused code checks, package metadata and architecture guards. Lint reported zero errors and 1799 warnings across the repository. `npm run verify:test-discovery` passed with all 1714 test files discovered exactly once. `git diff --check` passed. ## Compatibility, safety, and release Validation ran on macOS arm64 with Node 24.18.0 and npm 11.16.0. Fixtures are synthetic PE files and were never executed. Windows execution and compiler produced binaries were not tested. No external analysis engine is required for this reader. No breaking changes or migration steps. ## Author readiness Human owner: @adipatel399 - [x] I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work. - [x] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [x] I declare this PR ready for initial maintainer review. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-01 21:43:53 +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#6894
No description provided.