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

commit 53bbf4756c7f7c4e300406cd7f33a876ca9b4731
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]>

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 c558b62b2..2cad80a5a 100644
--- a/winsup/cygwin/fhandler/pty.cc
+++ b/winsup/cygwin/fhandler/pty.cc
@@ -2724,7 +2724,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')
              {
@@ -2752,6 +2751,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