https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=3c5e6fce0be78c645b743dbe2c4f6363e1fc8398

commit 3c5e6fce0be78c645b743dbe2c4f6363e1fc8398
Author: Takashi Yano <[email protected]>
Date:   Fri Dec 19 13:31:25 2025 +0900

    Cygwin: pty: Fix state initialization in pty_master_fwd_thread
    
    If the ESC sequence ends at the middle of the sequence, the 'state'
    remains non-zero. This prevent the next state machine from working
    as expected. On contrary, 'start_at' is set in each parser, so is
    not necessary to be initialized.
    
    Fixes: 10d083c745dd ("Cygwin: pty: Inherit typeahead data between two input 
pipes.")
    Suggested-by: Johannes Schindelin <[email protected]>
    Signed-off-by: Takashi Yano <[email protected]>
    (cherry picked from commit 53bbf4756c7f7c4e300406cd7f33a876ca9b4731)

Diff:
---
 winsup/cygwin/fhandler/pty.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/winsup/cygwin/fhandler/pty.cc b/winsup/cygwin/fhandler/pty.cc
index a91743875..03fd47858 100644
--- a/winsup/cygwin/fhandler/pty.cc
+++ b/winsup/cygwin/fhandler/pty.cc
@@ -2703,7 +2703,6 @@ fhandler_pty_master::pty_master_fwd_thread (const 
master_fwd_thread_param_t *p)
 
          /* Remove CSI > Pm m */
          state = 0;
-         start_at = 0;
          for (DWORD i = 0; i < rlen; i++)
            if (outbuf[i] == '\033')
              {
@@ -2731,6 +2730,7 @@ fhandler_pty_master::pty_master_fwd_thread (const 
master_fwd_thread_param_t *p)
              state = 0;
 
          /* Remove OSC Ps ; ? BEL/ST */
+         state = 0;
          for (DWORD i = 0; i < rlen; i++)
            if (state == 0 && outbuf[i] == '\033')
              {

Reply via email to