Skip to content

fix(tools): keep BinDiff from panicking on a full Git Bash pipe - #75

Merged
github-actions[bot] merged 1 commit into
masterfrom
fix/bindiff-pipe-panic
Nov 6, 2026
Merged

github-actions[bot] merged 1 commit into
masterfrom
fix/bindiff-pipe-panic

Conversation

@endercodezz

Copy link
Copy Markdown
Owner

What changed

p3p-bindiff panicked when its output filled a Git Bash pipe: those pipes are asynchronous, and the Zig 0.17.1 file writers treat PENDING as unreachable. The report is now built in memory and written once, through WriteFile on Windows. Exit codes are unchanged, also with a closed stdout (exit 2).

Verification

  • --elf with 3,000 changed sections through | cat: 1,083,473 bytes, identical to the output to a file, exit 1. Before the fix it stopped at about 73 KB with exit 3, in text and --json mode.
  • New test_output_to_a_full_asynchronous_pipe (Windows, overlapped pipe): fails with exit 3 on the build before the fix, passes now. Python's own pipes are synchronous and never showed this.
  • python tools/bindiff/check.py: format check, Debug and safe unit tests, 15/15 CLI tests. The x86_64-linux-musl cross-build passes; CI runs it on Linux.

Normal use was rarely affected: at most about 6.3 KB in byte mode, 919 bytes for --elf --json of the real EBOOT against itself.

Closes #74

Zig 0.17.1 file writers panic when an asynchronous pipe fills up, which
took about 200 changed ELF sections. The report is now built in memory
and written once, through WriteFile on Windows. Exit codes are unchanged.

Verified: 3,000 changed sections through a Git Bash pipe give the same
bytes as the output to a file; the new overlapped pipe test fails with
exit 3 before the fix; tools/bindiff/check.py 15/15 CLI tests.
@github-actions
github-actions Bot enabled auto-merge November 6, 2026 14:46
@github-actions
github-actions Bot merged commit 69069b8 into master Nov 6, 2026
7 checks passed
@endercodezz
endercodezz deleted the fix/bindiff-pipe-panic branch November 6, 2026 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BinDiff: panic when its output fills a Git Bash pipe

1 participant