Skip to content

Bound memory during file reads, not just tokenization (8 MiB cap reads whole file first) #87

Description

@dacharyc

Follow-up to #78. readFileWithCap in structure/tokens.go truncates to maxTokenizedFileBytes (8 MiB) only after util.SafeReadFile has read the entire file into memory, so a pathological multi-GB file in a skill package still gets fully loaded before the cap applies.

To deliver the intended bound, read with os.Open + io.LimitedReader (or add a SafeReadFileN(path, n) helper in util that combines the Lstat regular-file check with a limited read).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions