You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
unibi_from_fd/fp do not handle files larger than 4096 bytes #32
Part of the ncurses changes that went along with wide integer support was supporting files larger than 4K -- up to 32K in size. That wasn't accounted for at the time, and such files are now showing up in the wild.
$ stat -c '%s %n' /usr/share/terminfo/x/xterm{,-256color}=20
4156 /usr/share/terminfo/x/xterm
4242 /usr/share/terminfo/x/xterm-256color
The mentioned functions are the workers beneath unibi_from_term/env/file, so they're the most likely to be used by applications. However, they have a hard-coded limit of 4K, allocated on the stack.
Allocating 32K on the stack doesn't seem like a great idea.
The convenience functions could malloc the buffer, instead of using a stack allocation.
Or the existing, documented, limitations of these functions could be left in place and add new APIs could be added (ones that accept a buffer from the caller, or explicitly malloc internally).
Activity
jamessan commentedon Jun 13, 2026
Allocating 32K on the stack doesn't seem like a great idea.
The convenience functions could malloc the buffer, instead of using a stack allocation.
Or the existing, documented, limitations of these functions could be left in place and add new APIs could be added (ones that accept a buffer from the caller, or explicitly malloc internally).
Read up to 32K when reading a terminfo entry from a file
Read up to 32K when reading a terminfo entry from a file