]> git.kaiwu.me - njs.git/commit
Fixed redefinition of special props in Object.defineProperty().
authorDmitry Volyntsev <xeioex@nginx.com>
Thu, 19 May 2022 23:41:08 +0000 (16:41 -0700)
committerDmitry Volyntsev <xeioex@nginx.com>
Thu, 19 May 2022 23:41:08 +0000 (16:41 -0700)
commit6549d49630ce5f5ac823fd3ae0c6c8558b8716ae
tree021988507ea7fba97eba77e88bcc1cefc4d83850
parent6cef7f5055ec24275f0ae121c7f8709ff3e0c454
Fixed redefinition of special props in Object.defineProperty().

Previously, when NJS_PROPERTY_HANDLER property was updated it might be
left in inconsistent state.  Namely, prop->type was left unchanged, but
prop->value did not have an expected property handler.  As a result
consecutive reference to the property may result in a segment violation.

The fix is to update the prop->type during redefinition.

This closes #504 issue on Github.
src/njs_object.h
src/njs_object_prop.c
src/njs_value.c
src/njs_value.h
src/test/njs_unit_test.c