Skip to content

unibi_from_fd/fp do not handle files larger than 4096 bytes #32

Closed

Description

@jamessan

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.

Activity

  1. jamessan commented on Jun 13, 2026

    @jamessan
    MemberAuthor

    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).

  2. linked a pull request that will close this issueSupport terminfo files larger than 4K #33on Jun 30, 2026
  3. added 2 commits that reference this issue on Jun 30, 2026
    4e23039
    1436391
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Effort

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions