Skip to content

GET of a 0-byte object must not mmap 1 byte - #9

Merged
jaredLunde merged 2 commits into
beyondoss:mainfrom
paulocsanz:dst/b36-empty-get
Aug 15, 2026
Merged

GET of a 0-byte object must not mmap 1 byte#9
jaredLunde merged 2 commits into
beyondoss:mainfrom
paulocsanz:dst/b36-empty-get

Conversation

@paulocsanz

Copy link
Copy Markdown
Contributor

REST GET without Range used inclusive-end: size.saturating_sub(1) + 1. For a legal empty object that is length 1, so we mmap one byte past EOF.

HEAD already advertises Content-Length 0. S3 GetObject already uses the exclusive window (0, size). Darwin mmap fails with EINVAL (500). Linux returns a phantom 0x00.

Two commits: failing unit + REST tests, then exclusive full-GET window.

  • Full GET is (0, size) via get_window
  • length == 0 takes Body::empty()

Inclusive-end on size=0 is length 1. HEAD already advertises 0.
Darwin mmap fails with EINVAL (500); Linux returns a phantom 0x00.
Full GET uses the exclusive window (0, size), matching S3 GetObject
and HEAD Content-Length. size=0 now takes Body::empty() instead of
mmap past EOF.
@jaredLunde
jaredLunde merged commit 6e6471a into beyondoss:main Aug 15, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants