This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository terminology.
View the commit online.
commit 6763841a1b2ec94c1b298093d1511269751f2822
Author: Boris Faure <[email protected]>
AuthorDate: Sat Nov 28 20:46:19 2026 +0000
termptyesc: ignore window manipulations with a private marker
A private marker (>, ?, =, <) anywhere in the parameters rejects the
sequence: XTWINOPS is defined for plain CSI Ps ; Ps ; Ps t only
(ECMA-48 5.4.1). This also stops CSI > 22 t and CSI > 23 t from
pushing and popping the title stack, which they did until now because
_csi_arg_get() skipped the marker like any other non-digit.
Behaviour change, deliberate.
---
src/bin/termpty.c | 14 ++++++++++++++
src/bin/termptyesc.c | 13 ++++++++++++-
tests/tests.results | 2 +-
tests/xtwinops-report.sh | 10 +++++++++-
4 files changed, 36 insertions(+), 3 deletions(-)
diff --git a/src/bin/termpty.c b/src/bin/termpty.c
index 51400f59..34912d79 100644
--- a/src/bin/termpty.c
+++ b/src/bin/termpty.c
@@ -3523,6 +3523,20 @@ tytest_xtwinops_report(void)
_ty_feed(&ty, "\x1b[11t\x1b[13t\x1b[15t\x1b[19t\x1b[20t\x1b[21t");
assert(ty.write_buffer.len == 0);
+ /* a private marker gets no reply and no title-stack action */
+ _ty_feed(&ty, "\x1b]2;foo\007\x1b[>14t\x1b[>22;2t");
+ assert(ty.write_buffer.len == 0);
+ assert(!ty.title_icon_stack);
+ /* a marker after the first parameter is private too */
+ _ty_feed(&ty, "\x1b[14>2t\x1b[22>2t");
+ assert(ty.write_buffer.len == 0);
+ assert(!ty.title_icon_stack);
+ /* without the marker the stack still works */
+ _ty_feed(&ty, "\x1b[22;2t");
+ assert(ty.title_icon_stack);
+ _ty_feed(&ty, "\x1b[23;2t");
+ assert(!ty.title_icon_stack);
+
/* cell size not known yet: 14 and 16 answer 0 */
termpty_cell_size_set(&ty, 0, 0);
_ty_feed(&ty, "\x1b[14t\x1b[16t");
diff --git a/src/bin/termptyesc.c b/src/bin/termptyesc.c
index bfae2e3e..dcdf2dbe 100644
--- a/src/bin/termptyesc.c
+++ b/src/bin/termptyesc.c
@@ -3655,7 +3655,18 @@ static void
_handle_window_manipulation(Termpty *ty, Eina_Unicode **ptr)
{
Eina_Unicode *b = *ptr;
- int arg = _csi_arg_get(ty, &b);
+ Eina_Unicode *p;
+ int arg;
+
+ /* XTWINOPS is plain CSI Ps ; Ps ; Ps t only (ECMA-48 5.4.1) */
+ for (p = b; *p; p++)
+ if ((*p == '>') || (*p == '?') || (*p == '=') || (*p == '<'))
+ {
+ WRN("unhandled window manipulation with a private marker");
+ ty->decoding_error = EINA_TRUE;
+ return;
+ }
+ arg = _csi_arg_get(ty, &b);
if (arg == -ESC_ARG_ERROR)
return;
diff --git a/tests/tests.results b/tests/tests.results
index 3fef044a..61064a20 100644
--- a/tests/tests.results
+++ b/tests/tests.results
@@ -248,4 +248,4 @@ kitty-kbd-altscreen.sh df9913f9d85f856c75dd525a806da4f6
kitty-kbd-reset.sh bd10ee95b6b71d150fbe1a11c7b6ac94
kitty-kbd-unsupported.sh 63cfb663085848fd972e9ba667a2901b
kitty-kbd-malformed.sh 70f115545d4cda821177c842c2f96a7f
-xtwinops-report.sh 757afd3ceaccd27991020e2fa41613b5
+xtwinops-report.sh 1211fd5f75084a800c8f1b914bd8f423
diff --git a/tests/xtwinops-report.sh b/tests/xtwinops-report.sh
index 9d925312..a2dc23b4 100755
--- a/tests/xtwinops-report.sh
+++ b/tests/xtwinops-report.sh
@@ -15,5 +15,13 @@ printf '\033[8;30;100t'
printf '\033[18t\033[14t'
# still unanswered
printf '\033[11t\033[13t\033[15t\033[19t\033[20t\033[21t'
-# the title stack still works
+# the title stack still works without a marker: ends as "before"
printf '\033]2;before\007\033[22;2t\033]2;after\007\033[23;2t'
+# private marker: no reply
+printf '\033[>14t'
+# a marker after the first parameter is private too: no reply
+printf '\033[14>2t'
+# a private marker does not push the stack, wherever it stands: the pop
+# below finds nothing to restore, so the title stays "after"
+printf '\033]2;before\007\033[>22;2t\033]2;after\007\033[23;2t'
+printf '\033]2;before\007\033[22>2t\033]2;after\007\033[23;2t'
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.