René's URL Explorer Experiment


Title: TextDecoder: ERR_ENCODING_INVALID_ENCODED_DATA on very long array buffer · Issue #47645 · nodejs/node · GitHub

Open Graph Title: TextDecoder: ERR_ENCODING_INVALID_ENCODED_DATA on very long array buffer · Issue #47645 · nodejs/node

X Title: TextDecoder: ERR_ENCODING_INVALID_ENCODED_DATA on very long array buffer · Issue #47645 · nodejs/node

Description: Version v18.14.1 Platform Linux 5.19.0-38-generic #39~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Mar 17 21:16:15 UTC 2 x86_64 x86_64 x86_64 GNU/Linux Subsystem No response What steps will reproduce the bug? When I try to decode a long utf-16...

Open Graph Description: Version v18.14.1 Platform Linux 5.19.0-38-generic #39~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Mar 17 21:16:15 UTC 2 x86_64 x86_64 x86_64 GNU/Linux Subsystem No response What steps will reproduce the...

X Description: Version v18.14.1 Platform Linux 5.19.0-38-generic #39~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Mar 17 21:16:15 UTC 2 x86_64 x86_64 x86_64 GNU/Linux Subsystem No response What steps will reproduce the...

Opengraph URL: https://github.com/nodejs/node/issues/47645

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"TextDecoder: ERR_ENCODING_INVALID_ENCODED_DATA on very long array buffer","articleBody":"### Version\r\n\r\nv18.14.1\r\n\r\n### Platform\r\n\r\nLinux 5.19.0-38-generic #39~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Mar 17 21:16:15 UTC 2 x86_64 x86_64 x86_64 GNU/Linux\r\n\r\n### Subsystem\r\n\r\n_No response_\r\n\r\n### What steps will reproduce the bug?\r\n\r\nWhen I try to decode a long utf-16le encoded buffer, ERR_ENCODING_INVALID_ENCODED_DATA is thrown instead of ERR_STRING_TOO_LONG.\r\n```js\r\nnew TextDecoder(\"utf-16le\").decode(new Uint16Array(2**27).fill(48))\r\n// Uncaught TypeError: The encoded data was not valid for encoding utf-16le\r\n//     at TextDecoder.decode (node:internal/encoding:448:14) {\r\n//   code: 'ERR_ENCODING_INVALID_ENCODED_DATA'\r\n// }\r\n```\r\nThe default encoding version seems to work correctly, and throws an appropriate error\r\n```js\r\nnew TextDecoder().decode(new Uint8Array(2**29).fill(48))\r\n// Uncaught Error: Cannot create a string longer than 0x1fffffe8 characters\r\n//     at TextDecoder.decode (node:internal/encoding:433:16) {\r\n//   code: 'ERR_STRING_TOO_LONG'\r\n// }\r\n```\r\nAnother thing that I realized is that `TextDecoder()` seems to be capable of consuming an array buffer twice as long as `TextDecoder(\"utf-16le\")` without throwing error, and produce a string that's 4 times as long.\r\n\r\n### How often does it reproduce? Is there a required condition?\r\n\r\nConfirmed this bug in both normal file execution and node.js repl\r\n\r\n### What is the expected behavior? Why is that the expected behavior?\r\n\r\n`new TextDecoder(\"utf-16le\")` should be able to create a string up to 0x1fffffe8 characters.\r\nIt should throw ERR_STRING_TOO_LONG when this length is exceeded.\r\n\r\n### What do you see instead?\r\n\r\nERR_ENCODING_INVALID_ENCODED_DATA is thrown when the input Uint16Array length is 2**27\r\n```\r\nUncaught TypeError: The encoded data was not valid for encoding utf-16le\r\n    at TextDecoder.decode (node:internal/encoding:448:14) {\r\n  code: 'ERR_ENCODING_INVALID_ENCODED_DATA'\r\n}\r\n```\r\n\r\n### Additional information\r\n\r\n_No response_","author":{"url":"https://github.com/martian17","@type":"Person","name":"martian17"},"datePublished":"2023-04-20T16:10:17Z","url":"https://github.com/nodejs/node/issues/47645"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:394e26ba-c845-6a06-1051-df348c18567b
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idD36E:27868A:6BB6BC:9221A0:6AED27D2
html-safe-nonce37e59a25a906851227554b13555f83499f944a749430682a295a035e197751f7
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMzZFOjI3ODY4QTo2QkI2QkM6OTIyMUEwOjZBRUQyN0QyIiwidmlzaXRvcl9pZCI6Ijc4NzA4NjQ1NzIwMjc4NDA0NjYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac230a12bf478d267c0c0b0a38565f8274a2b017596e302dfe0e338af4b109459a
hovercard-subject-tagissue:1677024545
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/47645/issue_layout
twitter:imagehttps://opengraph.githubassets.com/8870c0ebd1a2e20a884fdf8d8351e42f4b665d614c252ca8cf5cd01f5a03c088/nodejs/node/issues/47645
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/8870c0ebd1a2e20a884fdf8d8351e42f4b665d614c252ca8cf5cd01f5a03c088/nodejs/node/issues/47645
og:image:altVersion v18.14.1 Platform Linux 5.19.0-38-generic #39~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Mar 17 21:16:15 UTC 2 x86_64 x86_64 x86_64 GNU/Linux Subsystem No response What steps will reproduce the...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamemartian17
hostnamegithub.com
expected-hostnamegithub.com
None9d95365dda0576efe9b71f45807595e396bd0ca9286fba5367a05048e6ddf8f2
turbo-cache-controlno-preview
go-importgithub.com/nodejs/node git https://github.com/nodejs/node.git
octolytics-dimension-user_id9950313
octolytics-dimension-user_loginnodejs
octolytics-dimension-repository_id27193779
octolytics-dimension-repository_nwonodejs/node
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id27193779
octolytics-dimension-repository_network_root_nwonodejs/node
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release98b41fa4b5635ceb45a4c54320fced73817ff290
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/nodejs/node/issues/47645#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F47645
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F47645
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=nodejs%2Fnode
Reloadhttps://github.com/nodejs/node/issues/47645
Reloadhttps://github.com/nodejs/node/issues/47645
Reloadhttps://github.com/nodejs/node/issues/47645
nodejshttps://github.com/nodejs
nodehttps://github.com/nodejs/node
Codehttps://github.com/nodejs/node
Issues657 (657)https://github.com/nodejs/node/issues
Pull requests666 (666)https://github.com/nodejs/node/pulls
Actionshttps://github.com/nodejs/node/actions
Projectshttps://github.com/nodejs/node/projects
Security and qualityhttps://github.com/nodejs/node/security
Insightshttps://github.com/nodejs/node/pulse
https://github.com/nodejs/node
New issuehttps://github.com/login?return_to=https://github.com/nodejs/node/issues/47645
New issuehttps://github.com/login?return_to=https://github.com/nodejs/node/issues/47645
#65634https://github.com/nodejs/node/pull/65634
TextDecoder: ERR_ENCODING_INVALID_ENCODED_DATA on very long array bufferhttps://github.com/nodejs/node/issues/47645#top
#65634https://github.com/nodejs/node/pull/65634
utilIssues and PRs related to the built-in util module.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22util%22
https://github.com/martian17
martian17https://github.com/martian17
on Apr 20, 2023https://github.com/nodejs/node/issues/47645#issue-1677024545
#39https://github.com/nodejs/node/issues/39
https://github.com/martian17
martian17https://github.com/martian17
on Apr 20, 2023https://github.com/nodejs/node/issues/47645#issuecomment-1516626647
VoltrexKeyvahttps://github.com/VoltrexKeyva
utilIssues and PRs related to the built-in util module.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22util%22
on Apr 20, 2023https://github.com/nodejs/node/issues/47645#event-9062207266
https://github.com/apps/github-actions
github-actionshttps://github.com/apps/github-actions
on Jun 3, 2026https://github.com/nodejs/node/issues/47645#issuecomment-4608462249
GitHub Actionshttps://help.github.com/en/actions
github-actionshttps://github.com/apps/github-actions
staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22stale%22
on Jun 3, 2026https://github.com/nodejs/node/issues/47645#event-26265060925
https://github.com/martian17
martian17https://github.com/martian17
on Jun 12, 2026https://github.com/nodejs/node/issues/47645#issuecomment-4686887708
github-actionshttps://github.com/apps/github-actions
staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22stale%22
on Jun 13, 2026https://github.com/nodejs/node/issues/47645#event-26700679017
https://github.com/JosephDoUrden
JosephDoUrdenhttps://github.com/JosephDoUrden
on Aug 29, 2026https://github.com/nodejs/node/issues/47645#issuecomment-5460172037
#61559https://github.com/nodejs/node/pull/61559
#61559https://github.com/nodejs/node/pull/61559
JosephDoUrdenhttps://github.com/JosephDoUrden
on Aug 30, 2026https://github.com/nodejs/node/issues/47645#event-30231734143
src: fix TextDecoder large-input and error pathshttps://github.com/JosephDoUrden/node/commit/4524fad6f8b74810f1c73a36e52f05dc07e0007f
4524fadhttps://github.com/JosephDoUrden/node/commit/4524fad6f8b74810f1c73a36e52f05dc07e0007f
src: fix TextDecoder large-input and error pathshttps://github.com/JosephDoUrden/node/commit/77c5bcd7306db03d746fcf3d9b41f1faf6350687
77c5bcdhttps://github.com/JosephDoUrden/node/commit/77c5bcd7306db03d746fcf3d9b41f1faf6350687
Sign up for freehttps://github.com/signup?return_to=https://github.com/nodejs/node/issues/47645
Sign in to commenthttps://github.com/login?return_to=https://github.com/nodejs/node/issues/47645
utilIssues and PRs related to the built-in util module.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22util%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.