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 38999a0b7dece71fce0d801173621eee6eba2fb8
Author: Boris Faure <[email protected]>
AuthorDate: Fri Nov 6 21:16:13 2026 +0000

    termptyesc: append REP's characters in bulk
    
    REP called termpty_text_append() once per repeated character, so every
    copy paid for the whole per-call setup and never reached the ASCII run
    fast path. A REP is now handed over in chunks of up to 256 copies.
    
    A REP's count is clamped to just under two screens, which a fuzzer
    input repeating a huge REP turns into seconds of work: such inputs
    were most of the hangs of the AFL campaign.
---
 src/bin/termptyesc.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/bin/termptyesc.c b/src/bin/termptyesc.c
index 18de962a..b68b4393 100644
--- a/src/bin/termptyesc.c
+++ b/src/bin/termptyesc.c
@@ -3279,8 +3279,9 @@ _handle_esc_csi_rep(Termpty *ty, Eina_Unicode **ptr)
 
    if (ty->last_char)
      {
+        Eina_Unicode run[256];
         int screen_size = ty->w * ty->h;
-        int i;
+        int i, n;
 
         if (arg <= 0)
           {
@@ -3293,9 +3294,13 @@ _handle_esc_csi_rep(Termpty *ty, Eina_Unicode **ptr)
               */
              arg = screen_size + (arg % screen_size);
           }
-        for (i = 0; i < arg; i++)
+        n = MIN(arg, (int)EINA_C_ARRAY_LENGTH(run));
+        for (i = 0; i < n; i++)
+          run[i] = ty->last_char;
+        for (; arg > 0; arg -= n)
           {
-             termpty_text_append(ty, &ty->last_char, 1);
+             n = MIN(arg, (int)EINA_C_ARRAY_LENGTH(run));
+             termpty_text_append(ty, run, n);
           }
      }
 }

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

Reply via email to