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 82d6351ef7d0bccb6cf7d8068843bcb53634ba5b
Author: Boris Faure <[email protected]>
AuthorDate: Tue Nov 3 16:46:46 2026 +0000

    tytest_common: add tytest_common_feed_chunked(); uncap --chunk
    
    A --chunk over 4096 silently read 4096 bytes at a time, the size of
    tytest's read buffer. The fuzzer needs reads of up to 256 KiB, the
    size of one wakeup's burst, to reach the buffering of sequences that
    span reads: --chunk now feeds reads of any size.
---
 src/bin/tytest_common.c | 30 ++++++++++++++++++++++++++----
 src/bin/tytest_common.h |  1 +
 2 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/src/bin/tytest_common.c b/src/bin/tytest_common.c
index 04222564..bf8edf7d 100644
--- a/src/bin/tytest_common.c
+++ b/src/bin/tytest_common.c
@@ -821,17 +821,38 @@ tytest_common_set_chunk(int chunk)
    if (chunk > 0) _read_chunk = chunk;
 }
 
+/* Feed len bytes in chunks of chunk bytes, as if read() kept returning that
+ * size. chunk <= 0 hands everything over in one call, which is what a burst
+ * of up to 64 reads in one wakeup approximates. */
+void
+tytest_common_feed_chunked(const char *data, int len, int chunk)
+{
+   int i;
+
+   if (chunk <= 0)
+     {
+        tytest_common_feed(data, len);
+        return;
+     }
+   for (i = 0; i < len; i += chunk)
+     tytest_common_feed(data + i, MIN(chunk, len - i));
+}
+
 void
 tytest_common_main_loop(void)
 {
-   char buf[4096];
-   int len, want;
+   char *buf;
+   int len;
 
-   want = MIN((int)sizeof(buf), _read_chunk);
+   /* Sized to the whole read: a chunk larger than 4096 is the point, not the
+    * exception -- _handle_read() reads 4096 bytes per read() and the buffer
+    * must let --chunk explore beyond it. */
+   buf = malloc(_read_chunk);
+   assert(buf);
 
    do
      {
-        len = read(_ty.fd, buf, want);
+        len = read(_ty.fd, buf, _read_chunk);
         if (len < 0 && errno != EAGAIN)
           {
              ERR("error while reading from tty slave fd");
@@ -842,6 +863,7 @@ tytest_common_main_loop(void)
         tytest_common_feed(buf, len);
      }
    while (1);
+   free(buf);
 }
 
 /* Restore every piece of state the parser reaches through the termio_* stubs,
diff --git a/src/bin/tytest_common.h b/src/bin/tytest_common.h
index ffe175f0..c7486627 100644
--- a/src/bin/tytest_common.h
+++ b/src/bin/tytest_common.h
@@ -11,6 +11,7 @@
 
 void tytest_common_main_loop(void);
 void tytest_common_feed(const char *data, int datalen);
+void tytest_common_feed_chunked(const char *data, int len, int chunk);
 void tytest_common_reset(void);
 void tytest_common_set_chunk(int chunk);
 void tytest_common_init(void);

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

Reply via email to