Skip to content

fix(node/fs): readSync with position argument returns EINVAL - #34021

Merged
bartlomieju merged 3 commits into
mainfrom
orch/issue-56
May 13, 2026
Merged

bartlomieju merged 3 commits into
mainfrom
orch/issue-56

Conversation

@littledivy

Copy link
Copy Markdown
Member

Closes denoland/orchid#56

divybot and others added 3 commits May 13, 2026 08:46
The position argument to fs.readSync (and fs.read) was being passed
through the op as #[number], which silently rounds large bigints. The
JS polyfill then coerced any non-null position to Number, mangling
positions > 2^53. The Node test
`parallel/test-fs-readSync-position-validation.mjs` exercises positions
up to 2^63-1n and expects them to be accepted (or fail with EFBIG /
EOVERFLOW), but Deno rejected them with EINVAL.

Switch the ops to `#[bigint]` and pass the position as BigInt from the
polyfills. validatePosition already enforces the Node-compatible range,
so out-of-range values throw ERR_OUT_OF_RANGE before reaching the op.

Closes denoland/orchid#56
@bartlomieju
bartlomieju merged commit 69aad77 into main May 13, 2026
136 checks passed
@bartlomieju
bartlomieju deleted the orch/issue-56 branch May 13, 2026 15:54
littledivy added a commit to crowlKats/deno that referenced this pull request Jun 10, 2026
…d#34021)

Co-authored-by: divybot <divybot@users.noreply.github.com>
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.

3 participants