Skip to content

create_request_stream / create_push_stream use keys.last instead of keys.max #11

@phluid61

Description

@phluid61

File: lib/ruby-h2/http-agent.rb:265,278

Both methods use @streams.keys.last to find the highest existing stream ID. Ruby hashes maintain insertion order, not numerical order.

If streams are inserted out of numerical order (e.g. server creates push stream 2, receives client stream 3, creates push stream 4, then receives a delayed lower-numbered client stream), keys.last could return a stale value and generate a stream ID that was already used.

Fix: use @streams.keys.max instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions