Skip to content

host_streams: enforce the spec buffer bound on host buffers; document cancelRead-vs-EOS at the conventions layer #97

Description

@lann

Severity: low.

  1. HostBuffer (exec/host_streams.ts:105-113) does not enforce the spec's
    Buffer.MAX_LENGTH (2^28 - 1, definitions.py:919/938). No packing
    overflow is reachable (guest-side progress is what gets packed), but a
    larger host offer silently exceeds the spec bound. Enforce at
    construction.

  2. Stream.cancelRead() (embedder/streams.ts:280-282) resolves the
    in-flight read with an empty chunk (host_streams.ts:599-603), which
    readable()/the async iterator interpret as clean end-of-stream — a
    cancelled read is indistinguishable from EOS at the conventions layer.
    Ruling: keep the behavior (the canceller is the same code observing the
    end), document it explicitly at both sites and in embedder-api.md
    (orchestrator authors the contract sentence), and pin it with a test.

Found in the 2026-08-10 adversarial conformance review (runtime + translator vs component-model @ 73b7ad5 definitions.py; wasmtime-environ 47.0.3 treated as trusted).

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