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.
Found while fixing #10426 (PR #10644), which added the internal
<encoding>Slice/<encoding>Writemethods toBuffer.prototypeand, in doing so, had to fix a dormant gap injs_buffer_write_len: encoding tag 6(utf16le/ucs2) was never handled, so the newly-added
ucs2Writewould not have worked.js_buffer_write— the no-length sibling ofjs_buffer_write_len— has the same missing-encoding gap and wasdeliberately 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_lenincrates/perry-runtime/src/object/native_module/buffer_dispatch.rs. A test should cover both entry points with allencodings, so the two cannot drift apart again; the reason this one was missed is precisely that the two siblings
were fixed independently.