Title: buffer: fill ignores an explicit end when offset is undefined · Issue #67574 · nodejs/node · GitHub
Open Graph Title: buffer: fill ignores an explicit end when offset is undefined · Issue #67574 · nodejs/node
X Title: buffer: fill ignores an explicit end when offset is undefined · Issue #67574 · nodejs/node
Description: Version Node.js v24.22.2, v26.13.0 and v26.13.1 Platform macOS 15.2, Darwin 24.2.0, arm64. Subsystem buffer What steps will reproduce the bug? Save as repro.cjs: for (const value of [1, 'a', Buffer.from([7])]) { console.log('undefined of...
Open Graph Description: Version Node.js v24.22.2, v26.13.0 and v26.13.1 Platform macOS 15.2, Darwin 24.2.0, arm64. Subsystem buffer What steps will reproduce the bug? Save as repro.cjs: for (const value of [1, 'a', Buffer...
X Description: Version Node.js v24.22.2, v26.13.0 and v26.13.1 Platform macOS 15.2, Darwin 24.2.0, arm64. Subsystem buffer What steps will reproduce the bug? Save as repro.cjs: for (const value of [1, 'a'...
Opengraph URL: https://github.com/nodejs/node/issues/67574
X: @github
Domain: github.com
IPv4 address: 140.82.113.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"buffer: fill ignores an explicit end when offset is undefined","articleBody":"### Version\n\nNode.js v24.22.2, v26.13.0 and v26.13.1\n\n### Platform\n\n```text\nmacOS 15.2, Darwin 24.2.0, arm64.\n```\n\n### Subsystem\n\nbuffer\n\n### What steps will reproduce the bug?\n\nSave as `repro.cjs`:\n\n```js\nfor (const value of [1, 'a', Buffer.from([7])]) {\n console.log('undefined offset:', Buffer.alloc(4).fill(value, undefined, 2));\n console.log('zero offset:', Buffer.alloc(4).fill(value, 0, 2));\n}\n```\n\nRun:\n\n```sh\nnode repro.cjs\n```\n\n### How often does it reproduce? Is there a required condition?\n\nEvery run when offset is undefined and end is explicitly supplied. The example uses number, string and Buffer fill values.\n\n### What is the expected behavior? Why is that the expected behavior?\n\n```text\nundefined offset: \u003cBuffer 01 01 00 00>\nzero offset: \u003cBuffer 01 01 00 00>\nundefined offset: \u003cBuffer 61 61 00 00>\nzero offset: \u003cBuffer 61 61 00 00>\nundefined offset: \u003cBuffer 07 07 00 00>\nzero offset: \u003cBuffer 07 07 00 00>\n```\n\nThe [buf.fill documentation](https://nodejs.org/api/buffer.html#buffillvalue-offset-end-encoding) gives offset a default of 0 and defines end as the exclusive stopping position. Defaulting offset should preserve the explicitly supplied end, giving the same result as offset=0.\n\n### What do you see instead?\n\nThe listed versions produce:\n\n```text\nundefined offset: \u003cBuffer 01 01 01 01>\nzero offset: \u003cBuffer 01 01 00 00>\nundefined offset: \u003cBuffer 61 61 61 61>\nzero offset: \u003cBuffer 61 61 00 00>\nundefined offset: \u003cBuffer 07 07 07 07>\nzero offset: \u003cBuffer 07 07 00 00>\n```\n\n### Additional information\n\nIn [_fill](https://github.com/nodejs/node/blob/v26.13.1/lib/buffer.js), the undefined-offset branches set both offset=0 and end=buf.length. The reproduction keeps end within bounds to isolate this behavior.\n\nAI tools assisted with analysis and preparation of this report and its reproduction. A human has reviewed and confirmed the issue and verified that it is reproducible.\n\nCredit: UCSB PLSE — https://ucsbplse.github.io/","author":{"url":"https://github.com/archidoge0","@type":"Person","name":"archidoge0"},"datePublished":"2026-11-18T13:04:35Z","url":"https://github.com/nodejs/node/issues/67574"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:3f0a6d17-da82-766f-cb80-ce4c74555ab7 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A0AC:39588:37CCE3:4AA2CE:6B0619A2 |
| html-safe-nonce | fbfd689fbf5e2f50cf559cf1d30f562e8ad7d600ec99a8de1acf3b6b548a4ceb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMEFDOjM5NTg4OjM3Q0NFMzo0QUEyQ0U6NkIwNjE5QTIiLCJ2aXNpdG9yX2lkIjoiNzk2NzMxOTI1OTY0MDg5NTkwNiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 95685b6e8d5f65e7f58276270d8367e25f8c3608ed5f05406bfbf92a8373ecba |
| hovercard-subject-tag | issue:6467781225 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/67574/issue_layout |
| twitter:image | https://opengraph.githubassets.com/47abe5408eafa59406a4a4cc99e0e18ab60d2a6d3cc0a7dde9eeb7f4444c3807/nodejs/node/issues/67574 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/47abe5408eafa59406a4a4cc99e0e18ab60d2a6d3cc0a7dde9eeb7f4444c3807/nodejs/node/issues/67574 |
| og:image:alt | Version Node.js v24.22.2, v26.13.0 and v26.13.1 Platform macOS 15.2, Darwin 24.2.0, arm64. Subsystem buffer What steps will reproduce the bug? Save as repro.cjs: for (const value of [1, 'a', Buffer... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | archidoge0 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 97d4714e567728e1f85f88b0cf68c89f0f8a3dc41e8869af7aeb8195ad990374 |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 866f202ebf7ac5aff8f633417d9fd8a53818a977 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width