Fix CSI sequence parsing, Windows NO_COLOR compliance, readSecret abort, and mode token safety - #54
Merged
Conversation
… safety - recognize all ECMA-48 final bytes (0x40..0x7E) in CSI sequence parsing - treat empty NO_COLOR as set on Windows per no-color spec - emit newline on Escape abort in POSIX readSecret - auto-restore terminal mode on ModeToken destruction - guard CSI numeric parameter parsing against integer overflow - reject NAN in readKey timeout parameters - add PHPT tests for all fixes Fixes #53
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #53
Summary of Changes
0x40..0x7E(@through~, including lowercasea-z) interminal_is_csi_final_byte(). Prevents stalls on SGR (\e[0m), device attributes (\e[?1;2c), and other valid ANSI sequences.NO_COLOR=as active on Windows to conform to the no-color specification and maintain parity with POSIX.\nto stdout on Escape abort before restoring terminal attributes, matching Windows and Ctrl+C/Ctrl+D behavior.terminal_mode_token_free_obj()if the token is garbage-collected or dropped beforerestoreMode()is called.unsigned intoverflow.NANvalues inreadKey()timeout parameters with aValueError.Test Coverage
Added 4 new PHPT test cases:
tests/027_csi_lowercase_final_byte.phpttests/028_read_secret_escape_abort.phpttests/029_mode_token_auto_restore.phpttests/030_read_key_nan_validation.phpt