Skip to content

osiris_log: Fix infinite recursion with segment size smaller than header#217

Draft
the-mikedavis wants to merge 1 commit into
mainfrom
md/max-seg
Draft

osiris_log: Fix infinite recursion with segment size smaller than header#217
the-mikedavis wants to merge 1 commit into
mainfrom
md/max-seg

Conversation

@the-mikedavis
Copy link
Copy Markdown
Collaborator

@the-mikedavis the-mikedavis commented May 16, 2026

The minimum size of any segment is always the header size (8 bytes, MAGIC plus 32 bit version). When setting the segment size bytes to a single byte, the transition to the second segment would always recurse indefinitely because transitioning to the next segment could never succeed. This change bails out and allows a 1-byte max segment size to mean a single chunk per segment.

This is a total edge-case and not probably worth worrying about, but this is possible because the header x-stream-max-segment-size-bytes does not check against a minimum. It is only checked to be non-negative and under a maximum.

The minimum size of any segment is always the header size (8 bytes,
MAGIC plus 32 bit version). When setting the segment size bytes to a
single byte, the transition to the second segment would always recurse
indefinitely because transitioning to the next segment could never
succeed. This change bails out and allows a 1-byte max segment size to
mean a single chunk per segment.
@the-mikedavis the-mikedavis requested a review from kjnilsson May 16, 2026 20:57
@the-mikedavis the-mikedavis self-assigned this May 16, 2026
@the-mikedavis the-mikedavis added the bug Something isn't working label May 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant