Re: [PATCH 1/2] tests:common: Increse buffer size to allow input for PQC testing.
Jacob Bachmeyer via Gcrypt-devel <[email protected]> Thu, 26 Jun 2025 01:00:15 -0500
| Newsgroups | gmane.comp.encryption.gpg.libgcrypt.devel |
|---|---|
| Message-ID | <[email protected]> |
On 6/26/25 00:10, NIIBE Yutaka via Gcrypt-devel wrote: > * tests/t-common.h (read_textline): Increase the buffer size. I understand that this is testsuite code, so a fixed stack buffer is not the serious problem it could otherwise be, but why not replace the fixed buffer with a heap-allocated buffer, expanded as needed using realloc()? This would also allow the working buffer to be returned and freed by the caller, eliminating the final xstrdup() call. A quick glance at src/stdmem.c suggests that libgcrypt already has the infrastructure to implement this. I suggest making the buffer expansion power-of-2 starting from some initial size (256?) and doubling each time the buffer is filled without having read a complete line. A hard limit (1MiB?) could be useful as well. -- Jacob _______________________________________________ Gcrypt-devel mailing list [email protected] https://lists.gnupg.org/mailman/listinfo/gcrypt-devel