Skip to content

tarballs_v1 crashes on <= 2 bytes with IndexDefect #103

@hourianto

Description

@hourianto

tarballs_v1.openStreamImpl reads the entire stream into data and, when tarballFormat == tfDetect, immediately inspects:

  • data[0]
  • data[1]

There is no prior length check. Empty input, and also one-byte input, therefore causes direct indexing into an undersized string.

import std/streams
import zippy/tarballs_v1

Tarball().open(newStringStream(""))

Found by GPT 5.4.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions