fix: prevent lifecycle guard crashes on NUL paths - #79837
Conversation
Duplicate of #78430. That earlier PR catches the embedded-NUL ValueError at os.open, whereas this patch catches after the descriptor would already need to be created. |
|
Closing as superseded by #80258, which fixes this whole bug class architecturally rather than per-callsite: path candidates are sanitized once at the ingestion boundary (NUL/empty/unexpandable tokens rejected before any OS call), text from any Your report and fix targeted a real member of this class — thank you. The per-callsite patches kept leaving sibling frames exposed (#76762 → #77703 → #77780 → #78256 each crashed one frame away from the previous fix), which is why we went with the boundary fix instead of merging the fragments individually. #80258 carries regression tests for the NUL-path, binary-callback, oversized-read, unset-HOME, and walk-crash cases plus an adversarial never-raises sweep. |
Summary
Prevents the terminal lifecycle guard from crashing when recursive referenced-script inspection reaches a path token containing an embedded NUL byte.
The observed trigger was a command that invoked a native binary by full path. Its decoded binary contents produced NUL-bearing tokens; os.open() raises ValueError for those tokens, while this recovery path previously caught only OSError.
Change
Validation
No configuration or public API changes.