]> git.kaiwu.me - njs.git/commit
Fix Object.defineProperty() with reentrant descriptors
authorDmitry Volyntsev <xeioex@nginx.com>
Fri, 4 Sep 2026 01:48:11 +0000 (18:48 -0700)
committerDmitry Volyntsev <xeioexception@gmail.com>
Fri, 4 Sep 2026 21:53:08 +0000 (14:53 -0700)
commit8f5a628bf59feffe25385cf93097eab211f75bad
treecf6ddf91a4d7619801da6d679cab9ca263ff74f0
parente68fef653d416056af88884b70cd6252bef2140a
Fix Object.defineProperty() with reentrant descriptors

Previously, njs_object_prop_define() retained a pointer to a target hash
property while descriptor getters executed user code.  Reentrant mutation of
the target could resize the flat hash and leave the retained pointer dangling.
Descriptor getters were also evaluated again after fast-array conversion.

The fix is to convert the descriptor before querying the target and to place
the retry point after descriptor conversion.

The issue was introduced in 2f288a9c (0.9.1).

This closes #1089 issue on GitHub.
src/njs_object_prop.c
src/test/njs_unit_test.c