Skip to content

js_buffer_write does not handle encoding tag 6 (utf16le/ucs2), the same dormant gap PR #10644 fixed in its js_buffer_write_len sibling #10645

Description

@proggeramlug

Found while fixing #10426 (PR #10644), which added the internal <encoding>Slice/<encoding>Write methods to
Buffer.prototype and, in doing so, had to fix a dormant gap in js_buffer_write_len: encoding tag 6
(utf16le/ucs2) was never handled
, so the newly-added ucs2Write would not have worked.

js_buffer_write — the no-length sibling of js_buffer_write_len — has the same missing-encoding gap and was
deliberately left alone as out of scope for that PR.

It is dormant in the same way the other one was: nothing reached it with encoding tag 6 before, so it produced no
visible symptom. That changes as soon as something routes a utf16le/ucs2 write through the no-length path.

Fix shape is already written — mirror what PR #10644 did to js_buffer_write_len in
crates/perry-runtime/src/object/native_module/buffer_dispatch.rs. A test should cover both entry points with all
encodings, so the two cannot drift apart again; the reason this one was missed is precisely that the two siblings
were fixed independently.

Metadata

Metadata

Assignees

No one assigned

    Labels

    package-auditFound by the 2026 package audit: compiling real npm packages from source instead of native bindings

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions