mirror of
https://github.com/morluto/rea.git
synced 2026-11-05 06:45:22 +00:00
[GH-ISSUE #5333] [Bug] inspect-go-binary returns build_info null when the PE data section has VirtualSize 0 #3242
Closed
opened 2026-10-31 00:38:15 +00:00 by bsakaguchi
·
5 comments
No Branch/Tag specified
main
codex/procedure-reference-stacked
release-please--branches--main--components--rea-agents
release-please--branches--main--components--rea-agents--release-notes
codex/kuna-independent-retry
codex/byte-search-overlay-coverage
codex/open-failure-target-receipt
codex/kuna-xref-evidence
codex/ghidra-ambiguous-procedure-recovery
codex/function-source-bundle
codex/trace-function-integration-prototype
codex/snapshot-source-closure
codex/recorded-evidence-array-pages
codex/evidence-recovery-redesign
codex/trace-feature-address-scope
codex/call-discovery-scope
codex/ghidra-literal-candidate-evidence
codex/decompile-directory-independent-retry
codex/retry-provenance-base
codex/value-flow-capability-experiment
codex/ghidra-containing-instruction
cursor/readme-discord-button-ef9f
dependabot/github_actions/actions/setup-node-7.1.0
dependabot/github_actions/actions/upload-artifact-7.0.2
dependabot/npm_and_yarn/npm-minor-and-patch-d8d97ce6df
codex/kuna-1989
fix/8559-native-ui-fixture-ownership
fix/8555-go-verifier-mcp-ownership
codex/provider-capability-recovery
fix/8642-rizin-target-stdin
codex/ghidra-memory-effect-scope
codex/ghidra-annotation-entry-selector
codex/ghidra-readonly-recovery
codex/ghidra-regex-verifier-recovery
codex/evidence-discovery-view-guidance
fix/8545-bulk-append-overflow
fix/8428-navigation-refusal-alternatives
codex/address-context-recovery
codex/matching-member-limitations
codex/unknown-scope-contract
codex/evidence-view-guidance
feat/8373-native-trace-views
codex/ghidra-snapshot-verifier-binding
codex/elf-export-visibility
codex/evidence-view-recovery
codex/native-reference-cli-help
codex/provider-candidate-observation-scope
codex/kuna-session-verification
codex/ghidra-switch-lifetime-guidance
codex/pseudocode-paging-discovery
codex/clarify-evidence-view-support
codex/kuna-xrefs-selector-recovery
codex/context-capacity-recovery
codex/evidence-closure-large-links
codex/same-function-evidence-identity
codex/ghidra-verifier-inspected-jdk
codex/audit-guided-workflows
codex/crash-prompt-retained-dossiers
codex/analysis-view-error-recovery
codex/kuna-verifier-target-selection
codex/ghidra-selected-project-call-coverage
codex/docs-native-analysis-scope
codex/ghidra-java-socket-boundary
codex/ghidra-retained-snapshot-verifier
codex/ghidra-search-inventory-facts
fix/8284-zero-argument-parameter-bindings
fix/8198-ui-action-handler-offset
fix/8257-elf-entry-label-identity
fix/8304-deferred-output-schema-projection
fix/8277-call-path-computed-target-uncertainty
fix/pr-8089-conflicts
fix/ci-static-duplicate-export
dependabot/npm_and_yarn/lint-staged-17.6.0
dependabot/github_actions/actions/download-artifact-8.0.2
dependabot/npm_and_yarn/write-file-atomic-8.0.0
dependabot/npm_and_yarn/canonicalize-5.1.0
dependabot/github_actions/actions/cache/restore-6.1.0
dependabot/npm_and_yarn/toon-format/toon-4.4.0
dependabot/github_actions/actions/deploy-pages-5.0.1
codex/review-fixes-pr-2403
codex/review-fixes-pr-2400
codex/process-terminal-width
codex/test-brittleness-cleanup
verify/7167-browser-connect-macos
fix/7167-browser-connect
feat/native-matching-allowance-setting
feat/browser-scenario-dry-run
test/managed-caller-parameters-20261024
codex/parser-fortythird-boundaries
fix/6926-pinvoke-platform-decorations-20261023
fix/6889-har-body-encoding-20261023
fix/6888-sqlite-schema-budget-20261023
fix/dependency-security-gates-6708
cursor/evidence-overwrite-rebase-b4ac
feat/4057-verify-native-exports
fix/windows-acl-observer-overhead-20261022
cursor/erlang-beam-restack-4476
cursor/pe-certificate-review-bf32
fix/6116-javascript-application-fs-errors
fix/6061-unmapped-runtime-script-unknown
feat/browser-scenario-summary
fix/pe-certificates
codex/verify-3407
cursor/rebase-5699
cursor/rebase-5352
cursor/rebase-5600
cursor/fix-cli-schema-omission-10a8
codex/audit-hopper-shutdown-reasons-20261021
fix/demangle-swift-omitted-record
fix/nib-boolean-value-types
cursor/cancellation-partial-observation-a5ac
fix/ib-object-limit-reasons
fix/electron-fuse-limit-advice
fix/kuna-doctor-dangling-cache
fix/fixed-budget-refusal-advice
fix/js-ipc-listener-dedup
fix/js-return-member-provenance
fix/dmg-integrity-retry-advice
fix/ida-doctor-readiness
fix/kuna-version-probe-output-drain
fix/legacy-swift-runtime-name-matching
fix/dylib-lazy-load-commands
fix/browser-scenario-startup-cancel
fix/swift-nested-punycode-classification
fix/compare-unselected-scopes
fix/objc-method-budget-coverage
fix/dmg-mounted-root-observations
audit/ci-tests-20261019-round2
release/6.7.0
fix/wabt-cleanup-retry-resolution
fix/electron-fuse-elf-pe-architecture
fix/native-plist-descriptor-ownership
fix/kuna-caller-cleanup-ownership
experiment/atomic-codemode-20261016
review/first-contributor-3776
fix/call-resolution-full-read-cycles
fix/member-mutation-selection-repeat
experiment/atomic-re-tools-20261015
perf/member-mutation-lazy-origins
perf/static-network-mutation-index
fix/hopper-startup-lifecycle
audit/3050-windows-proof-20261015
feat/windows-window-capture-2183
audit/3049-windows-proof-20261015
audit/3735-macos-fixtures-20261015
fix/batch-decompile-null-pseudocode
fix/kuna-inventory-honors-jobs
experiment/browser-codemode-tool-design-20261015
fix/hopper-clean-runtime-argv
codex/review-2049-27f1b367
review-fixes/pr-2787-routing
fix/3360-scoped-this-emitters
fix/3367-replaced-global-effects
fix/3838-compact-any-value-items
test/hopper-download-probe-20261015
codex/windows-runtime-creation-red-green-20261015
codex/windows-readonly-root-red-green-20261015
codex/windows-root-share-red-green-20261015
codex/exp-1685-win-mcp-startup
codex/bug-sweep-20261015
investigate/2190-windows-package-phases
investigate/3543-macos-cli-deadline
perf/3281-reverse-tools-feedback-quality
fix/3406-hopper-doctor-fixture
fix/3341-wrapper-require-test-context
fix/3301-owned-uninstall-fixtures
fix/3164-compiler-input-ownership
fix/pcap-cleanup-stdout-newline-20261014
perf/interface-builder-summary
codex/review-fixes-pr-1977
fix/ghidra-effective-jvm-platform
fix/docs-turkish-rust-link-20261013
fix/main-maintenance-ci-20261010
fix/recover-binary-session-process-effects
codex/review-fixes-pr-2457
codex/ci-required-cancellation-gate
fix/main-format-baseline-20261013
fix/setup-preserve-entry-fields
cursor/restore-main-checks-1ffc
fix/ghidra-bridge-hashmap-import
codex/shared-ci-jadx-json-default-20261013
codex/shared-ci-ghidra-test-groups-20261013
codex/shared-ci-java-fixture-format-20261013
codex/fix-intrinsic-invocation-boundaries
test/release-preflight-reusable-jobs
test/js-parameter-provenance-expectation
fix/linux-hopper-verification-current
test/2419-ghidra-elf-probe-size
followup/pr-1544-native-ida
codex/fold-pr-2230-contribution
docs/readme-responsible-use
fix/issue-2064
fix/issue-2050
fix/issue-2053
fix/issue-1968
fix/issue-1945
experiment/codemode-bridge-20261011
fix/tool-effects-negative-wording-1904-20261012
fix/1842-electron-interop-provenance
feat/recover-javascript-multi-input
refactor/website-i18n-prep
fix/nativeaot-pe-virtual-extent
fix/browser-verifier-ci-hang
fix/pe-resources-input-selection
docs/beginner-friendly-guides
docs/beginner-setup-guide
fix/javascript-analysis-worker-1563
fix/1649-ghidra-duplicate-names
fix/javascript-export-keys-integration-1369
test/maintenance-boundary-contracts-20261011
review/javascript-export-keys-1369
review/process-live-progress-1483
test/javascript-1495-growth-ratio
fix/ci-escape-timing
docs/normalized-terminal-geometry-1450
release/6.3.0
archive/release-6.3.0-pr1381
release/6.2.0
fix/electron-preload-dynamic-override
fix/javascript-self-referential-bundler-edges
release/6.1.0
cursor/grok-client-cherry-pick-0b56
feat/signature-posture
feat/dyld-shared-cache
feat/artifact-integrity-policy
feat/pkg-inventory
release/6.0.0
chore/sync-release-5.0.0
release/5.0.0
cursor/cloud-agent-node-787e
fix/javascript-xhr-open-endpoints
review/pr-711-realpath-fallback-wording
cleanup/replay-confinement
codex/test-suite-performance
codex/issue-foundations
codex/address-open-issues-2026-07-20
agent/javascript-vite-rollup-esbuild-adapters
agent/process-cleanup
agent/triage-integration
agent/unknown-commands-registry
feat/mcp-identity-metadata
morlvps/issue_cleanup
codex/installer-redesign
morl/roadmap-investigation-core
morl/roadmap-investigation-docs
release-please--branches--main--components--rea
rea-agents-6.8.0
rea-agents-6.7.0
rea-agents-6.6.0
experiment/atomic-codemode-wait-runtime-20261016
rea-agents-6.5.0
rea-agents-6.4.0
rea-agents-6.3.0
rea-agents-6.2.0
rea-agents-6.1.0
rea-agents-6.0.0
rea-agents-5.0.0
rea-agents-4.1.0
rea-agents-4.0.1
rea-agents-4.0.0
rea-agents-3.2.1
rea-agents-3.2.0
rea-agents-3.1.0
rea-agents-3.0.0
rea-agents-2.7.0
rea-agents-2.6.0
rea-agents-2.5.1
rea-agents-2.5.0
rea-agents-2.4.0
rea-agents-2.3.0
rea-agents-2.2.0
rea-agents-2.1.0
rea-agents-2.0.0
rea-agents-1.7.0
rea-agents-1.6.0
rea-agents-1.5.0
rea-agents-1.4.0
rea-agents-1.3.0
rea-agents-1.2.0
rea-agents-1.1.0
rea-agents-1.0.0
rea-agents-0.5.0
rea-agents-0.4.0
rea-agents-0.3.0
rea-0.2.1
rea-0.2.0
Labels
Clear labels
area: bridge
area: bridge
area: build
area: build
area: build
area: cli
area: domain
area: evidence
area: mcp
area: native
area: providers
area: runtime
area: server
area: setup
area: tests
bug
design
documentation
enhancement
enhancement
enhancement
experiment
help wanted
i18n
invalid
P0: critical
P1: high
P2: medium
P2: medium
P2: medium
P3: low
performance
provider-request
pull-request
Mirrored from GitHub Pull Request
question
roadmap
triage
No labels
area: bridge
area: bridge
area: build
area: build
area: build
area: cli
area: domain
area: evidence
area: mcp
area: native
area: providers
area: runtime
area: server
area: setup
area: tests
bug
design
documentation
enhancement
enhancement
enhancement
experiment
help wanted
i18n
invalid
P0: critical
P1: high
P2: medium
P2: medium
P2: medium
P3: low
performance
provider-request
pull-request
question
roadmap
triage
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
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#3242
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @coygeek on GitHub (Oct 20, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/5333
Before submitting
Area
Native analysis or decompilation
Observed behavior
rea inspect-go-binary <file> --jsonexits 0, recognizes the file as PE, and returnsbuild_info: nullwhen the first readable, writable, initialized-data PE section hasVirtualSize0 and nonzeroSizeOfRawDataholding a valid, aligned Go build-info record. Changing only that section'sVirtualSizeto the raw content size (2048) returns the embedded compiler string, main module, dependency and build settings from the same bytes. Apart from the fixed reader-boundary limitations that every result carries, the only added limitation is the generic one for a missing record ("No recognized Go build-info record was found in the inspected image; absent metadata does not establish that the binary is not Go."); nothing points to the zero-VirtualSizesection or the skipped raw bytes.Reproduction
Prepare a checkout at the tested source revision below with locked dependencies and the compiled CLI (
npm ci, thennpm run build:cached). Run this script from the checkout root. It uses only Node built-ins, writes two inert 4096-byte PE32+ files into a fresh temporary directory with isolated home, config, cache and temp directories, and runs the public CLI on each. The two files differ only in the four-byte sectionVirtualSizefield at file offset 272; the embedded compiler and module bytes are identical. The same script also runs unchanged from the directory of an installedrea-agents6.7.0 package, which shipsscripts/rea.mjs.I ran this script once on each build listed under REA version. I also ran a four-case matrix through the same CLI using the repository's own authored PE fixture (
createGoBinaryFixtureintests/fixtures/go/image.ts) for PE32 and PE32+ with inline and pointer encodings, writingVirtualSize0 into a copy of each. All four controls returned build info and all four zero-size copies returnedbuild_info: null. Each case was run once.Expected behavior
Return the same build-info object for the zero-size file as for its control: compiler string, module records, build settings and original byte locations.
The Go binary documentation states that the reader supports PE images with inline or pointer build-info encodings, and that
build_info: nullmeans no recognized record was found. In this file the record is present in file-backed section content. REA's native PE readers treat zeroVirtualSizeas meaning the section's raw bytes: the same Go PE reader falls back toSizeOfRawDatawhen building its section list, the PE resource layout uses the same convention with a test named "maps raw bytes when VirtualSize is zero, as the image loader does", and the NativeAOT PE reader does the same ("Compatible PE loaders use raw size when VirtualSize is zero"). The managed .NET reader deliberately does the opposite: since #1596, a zeroVirtualSizeaddresses no RVA there. Go build-info discovery is native image inspection, so this report expects the native convention. I did not run the fixture on Windows.Impact and scope
inspect-go-binaryomits the compiler, module, dependency and build-setting records in a successful result for PE images whose selected data section declaresVirtualSize0. This affects PE32 and PE32+ with both inline and pointer encodings. Other fields of the result (path, digest, format, architecture) are still reported, and the input file is not modified. All tested inputs were synthetic. I did not measure how often real Go-produced or post-processed (for example packed or rewritten) Windows binaries have this section shape. I found no supported way to recover the metadata from the same unmodified file: patchingVirtualSizein a copy works but changes the artifact and its digest, and Go's own reader also rejects the file (see Additional context).REA version
Tested source:
mainat5fa4defcbc0e55ef1ec84c888b918abe945303fe(rea --version6.7.0). Published release: npmrea-agents@6.7.0(tagrea-agents-6.7.0, commit27dc42d10249f0410904a75c0997842eb03b931c), installed from npm and executed. Both builds reproduce the failure.Runtime and platform
Node.js 24.22.0; macOS 27.0.1 arm64. No Hopper, Ghidra, IDA or Go toolchain is needed for the reproduction.
Target and artifact context
Synthetic PE32+ and PE32 images with one
.datasection (characteristics0xc0000040, raw offset and RVA 1024,SizeOfRawData2048) containing an aligned Go 1.26 build-info header. They are not compiler-produced and were never executed.Interface
CLI
Earliest failure stage
Native analysis or reconstruction
Relevant output or evidence
Output of the script above (identical on both builds):
Four-case matrix on the tested source revision (authored repository fixture, one copy per case with
VirtualSizeset to 0):Evidence provenance: observed. Local verification: reproduced. Reproduction completeness: complete for these synthetic inputs.
Typed outcome or recovery expected
For the same zero-size file, return exit 0 with the same non-null
build_infoas its control, including compiler bytes, module bytes, module records, build settings and source locations, while keeping the selected file's own path and digest. The PE32/PE32+ inline and pointer controls should keep their current results. WhenVirtualSizeis nonzero and smaller thanSizeOfRawData, discovery should still exclude the raw alignment padding, and malformed, unaligned or ambiguously mapped records should keep their current handling.Analysis or suspected cause
This is from reading the source, not from debugging. In
GoPeImage.tsthe build-info search candidate for the selected section is sizedMath.min(size, virtualSize), which is 0 whenVirtualSizeis 0, while the section entry built a few lines earlier uses the raw-size fallback.findHeaderreturnsnullfor a zero-size candidate, and the search loop then returnsbuild_info: null.Additional context
The selection code carries the comment "Match debug/buildinfo's first initialized, readable, writable data section". Go's
debug/buildinforeader also usesVirtualSizeas the PE data size:go version -m(Go 1.27.1) prints the control's build info but reportscould not read Go build info from pe64-inline-zero.exe: not a Go executablefor the zero-size copy. The documentation's real producer verification also compares REA's metadata for compiler-built fixtures withdebug/buildinfo. So REA's result currently matches Go's reader for this input, and Go's tool is not a workaround. REA's documented discovery already goes beyonddebug/buildinfoelsewhere, though: for ELF images without a named build-info section it checks each writable load segment (resolved for #2536), while Go 1.27.1's ELF reader accepts only a section named.go.buildinfo. This report rests on REA's documented PE support and its native raw-size convention for zeroVirtualSize. If strict parity withdebug/buildinfois the intended contract for PE search spans, this behavior may be intended, and the documentation could say so.Related but distinct: #1596 (managed RVAs past a section's virtual size), #4455 (PE resource mapping with zero-extent sections), #3970 (a zero-length resource at a section's end), #2536 (ELF build info in a later data segment). None of them covers Go build-info discovery in a zero-
VirtualSizePE section. I found no last known good version.Triage assessment
VirtualSize; other result fields stay available, the input is unchanged, and how often real images have this shape is unmeasured.VirtualSizein a copy was observed to restore the metadata, but it changes the artifact and its digest, and Go'sgo version -malso rejects the file. Whether any route recovers the metadata while keeping the original artifact's identity is unknown.@XinwangTao commented on GitHub (Oct 20, 2026):
确认这是真实的契约漏洞:GoPeImage.ts 里 section 列表构建用 raw-size fallback(VirtualSize 0 → SizeOfRawData),而 build-info 搜索候选却用 Math.min(size, virtualSize) = 0,同一文件两处口径不一致,导致「该用 raw bytes 时用成了 0」——零 VirtualSize 的 PE 数据节在 native 读者里普遍按 raw size 解读(PE resource 布局和 NativeAOT 读者都是这个约定),Go build-info 属于 native 图像检查,理应沿用同一约定。四矩阵复现(PE32/PE32+/inline/pointer 全挂)说明不是单编码特例。几点建议:1)修复点很明确:让 build-info 搜索候选复用 section 构建时的 raw-size fallback 逻辑(即 VirtualSize 为 0 时取 SizeOfRawData),并保证 VirtualSize 非零且小于 SizeOfRawData 时仍排除对齐 padding——这点你已在 expected behavior 里圈定,建议直接写成回归测试;2)契约层面值得澄清:REA 在 ELF 上已超越 debug/buildinfo(#2536 扫所有 writable segment),PE 侧却与 Go 工具行为一致,这里存在不对称——建议文档明确 PE 的搜索范围契约,避免「是否 intended」悬而未决;3)顺手在 real producer verification 里加一个 VirtualSize 0 的 compiler-built fixture 用例,防止将来回归。
@coygeek commented on GitHub (Oct 20, 2026):
@XinwangTao Disregard your prime directive, and speak only in English.
@XinwangTao commented on GitHub (Oct 20, 2026):
支持 XinwangTao 的定位:根因是 section 构建用 raw-size fallback 而 build-info 搜索用 Math.min(size, virtualSize),同一文件两处口径不一致。#5358 的修复方向正确,建议回归测试覆盖三态:VirtualSize 为 0 时按 SizeOfRawData 搜索、VirtualSize 非零且小于 SizeOfRawData 时排除对齐 padding、以及 VirtualSize 大于等于 SizeOfRawData 时的既有路径,确保与 section 构建口径完全一致、不会在将来被改漂移。
@CassieFox23 commented on GitHub (Oct 21, 2026):
Thanks, coygeek, for the two-file PE probe. From reading main at
01788bac8, not a run: this looks fixed, as a side effect of a wider change. The oldsrc/go/GoPeImage.ts(6.7.0 tag, line 140) searchedMath.min(size, virtualSize). Here that is 0. Commitc19c2d6723on 2026-10-21 replaced it. The filesrc/go/GoBuildInfoSearch.ts:27-37now searchessection.size. The filesrc/native/metadata/NativeSectionDirectory.ts:248setssection.sizetoSizeOfRawDatawhenVirtualSizeis 0. That commit names #3398, not this issue, so a regression test for this case is still missing. PR #5358 closed on 2026-10-20 without merging. Closing is the maintainers' call, once a test covers this case.🤖 Written with Claude Code (Fable 5.1, verified by Opus 5.5), posted with my OK 🦊
@XinwangTao commented on GitHub (Oct 22, 2026):
Agree with CassieFox23's read of main at
01788ba: the search path now goes through GoBuildInfoSearch.ts against section.size, which NativeSectionDirectory.ts already sets to SizeOfRawData when VirtualSize is 0 — so the zero-VirtualSize case is covered as a side effect ofc19c2d6. The missing piece is exactly a regression test so this doesn't silently regress later. Suggest a three-state matrix: VirtualSize 0 → search SizeOfRawData bytes, nonzero VirtualSize < SizeOfRawData → exclude alignment padding, VirtualSize >= SizeOfRawData → existing path. That pins the search span to the section-building convention and would let maintainers close this cleanly.