This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch tymux-10-quiet-head
in repository terminology.

View the commit online.

commit 8a2c4a4e639ea629b3ea489878f184404c5b1cbd
Author: Boris Faure <[email protected]>
AuthorDate: Wed Nov 4 21:56:55 2026 +0000

    termpty: keep a pending sequence in place when a read adds to it
    
    When a read did not complete the sequence buffered by the previous
    one, termpty_handle_buf() copied the whole pending sequence into a new
    buffer although nothing was consumed: a 1 MiB escape took over two
    minutes read 3 bytes at a time. Found by AFL.
---
 src/bin/termpty.c       |  2 ++
 tests/tests.results     |  1 +
 tests/ty-escape-long.sh | 15 +++++++++++++++
 3 files changed, 18 insertions(+)

diff --git a/src/bin/termpty.c b/src/bin/termpty.c
index f2dc31e8..4556b52f 100644
--- a/src/bin/termpty.c
+++ b/src/bin/termpty.c
@@ -145,6 +145,8 @@ termpty_handle_buf(Termpty *ty, const Eina_Unicode *codepoints, int len)
              if (n == 0)
                {
                   Eina_Unicode *tmp = ty->buf;
+
+                  if (c == ty->buf) break;
                   ty->buf = NULL;
                   ty->buflen = 0;
                   bytes = ((char *)ce - (char *)c) + sizeof(Eina_Unicode);
diff --git a/tests/tests.results b/tests/tests.results
index 26526aeb..3d074fd3 100644
--- a/tests/tests.results
+++ b/tests/tests.results
@@ -206,3 +206,4 @@ crash_cup_col_over_margin.sh 400a5215c6e74782cbab076e2a81fff7
 dcs-cancel.sh 5802db97bcbf6f2ab0d8e49723fcfea8
 dcs-long.sh 56028fb44070f1bf64f323f751f0d79a
 backlog-long-line.sh f4423fa1c7069b9bf8a62045cc97dda3
+ty-escape-long.sh 83d61b472b818eb3d699021e14e45452
diff --git a/tests/ty-escape-long.sh b/tests/ty-escape-long.sh
new file mode 100755
index 00000000..168d8ef4
--- /dev/null
+++ b/tests/ty-escape-long.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+# shellcheck source=tests/utils.sh
+. "$(dirname "$0")/utils.sh"
+
+# clear screen
+printf '\033[2J'
+
+# move to 0; 0
+printf '\033[0;0H'
+
+# a 1 MiB terminology escape, ended by its NUL: nothing shows of it
+printf '\033}x'
+head -c 1048576 /dev/zero | tr '\0' 'A'
+printf '\000'
+printf 'A'

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to