]> git.kaiwu.me - njs.git/commit
Fix indexed fast paths for exotic objects
authorDmitry Volyntsev <xeioex@nginx.com>
Fri, 4 Sep 2026 01:47:58 +0000 (18:47 -0700)
committerDmitry Volyntsev <xeioexception@gmail.com>
Fri, 4 Sep 2026 21:53:08 +0000 (14:53 -0700)
commitbb6f23ccc119041657263555d686563097a3d09e
tree26d39777abeb5e2ffab4ef359370e8651345b69b
parentc785b5722504d05935c56f7a27254f2b73f7927b
Fix indexed fast paths for exotic objects

Previously, Object.values() and Object.entries() erased the concrete type of
an exotic receiver, while indexed property fast paths accepted any object
with the fast_array bit.  Typed arrays could consequently be interpreted as
njs_array_t objects, causing invalid memory reads and writes.

The fix is to preserve the receiver type during enumeration and to use
njs_is_fast_array() for both indexed get and set fast paths.

The issue was introduced in 69072164 (0.8.6); the overbroad fast path dates
to 912ab387 (0.3.8).

This closes #1098 issue on GitHub.
src/njs_object.c
src/njs_value.c
src/test/njs_unit_test.c