]> git.kaiwu.me - njs.git/commit
Buffer: convert QJS array-like lengths
authorDmitry Volyntsev <xeioex@nginx.com>
Tue, 22 Sep 2026 03:28:29 +0000 (20:28 -0700)
committerDmitry Volyntsev <xeioexception@gmail.com>
Fri, 25 Sep 2026 23:00:29 +0000 (16:00 -0700)
commitd2b6e6db651add450bfa2a8752a5feff5a0ec573
treeff3ef278b26b794526e20396988fd714e0215d5b
parent22124b2f305ee152a79471e480a4cba5a7777a93
Buffer: convert QJS array-like lengths

Convert array-like lengths through checked floating-point conversion before
applying ToLength semantics.  This avoids reading float-tagged QuickJS
numbers through the integer accessor.

The length is kept as a 64-bit value and passed to qjs_buffer_alloc()
unchanged, so an oversized length is rejected before any allocation
instead of being truncated.
src/qjs.h
src/qjs_buffer.c
test/buffer.t.js