Skip to content

Bound decompressed response size before buffering it #343

Open

Description

@ability-spec

requestPinned() caps the raw response at MAX_BYTES, but decodeBody() calls gunzipSync(), brotliDecompressSync(), and inflateSync() without an output-size limit. A small compressed response with an extreme expansion ratio can therefore allocate far more than 2 MiB before fetchCapped() applies its decoded-byte cap, potentially exhausting the CLI process.

Could we enforce MAX_BYTES as the decompressor's maxOutputLength and handle limit errors explicitly instead of returning raw compressed bytes? A regression test with a highly compressible payload would help lock this down.

Activity

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions