Skip to content

BinDiff: panic when its output fills a Git Bash pipe #74

Closed

Description

@endercodezz

Why

[VERIFIED] Found while testing #65. Zig 0.17.1 panics when stdout is an asynchronous pipe that fills up (.PENDING => unreachable for a handle not marked nonblocking, lib/std/Io/Threaded.zig). Pipes of Git Bash/MSYS are asynchronous.

[VERIFIED] p3p-bindiff --elf on two synthetic ELFs with 3,000 changed sections, Windows, Git Bash: output to a file is 1,083,473 bytes, exit 1. | cat stops after about 73 KB with panic: reached unreachable code, exit 3, in text and --json mode.

[VERIFIED] The risk in normal use is low: byte mode prints at most about 6.3 KB, and --elf --json on the real EBOOT against itself prints 919 bytes. It takes roughly 200 changed sections or segments to fill the pipe.

Scope

Write stdout on Windows through WriteFile, which waits for a pending write, as tools/cpk does (#73). Exit codes stay as they are.

Verification

  • A CLI test with an overlapped pipe on Windows that fails with exit 3 before the fix (the pipes of Python's subprocess are synchronous, so they don't show this).
  • The reproduction above through a Git Bash pipe gives the same bytes as the output to a file.

Activity

  1. added
    bug
    on Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions