]> git.kaiwu.me - njs.git/commit
Fixed Error() instance dumping when "name" prop is not primitive.
authorDmitry Volyntsev <xeioex@nginx.com>
Tue, 28 Feb 2023 06:14:34 +0000 (22:14 -0800)
committerDmitry Volyntsev <xeioex@nginx.com>
Tue, 28 Feb 2023 06:14:34 +0000 (22:14 -0800)
commit9cec874582b925e373adb0896b85a112702f6664
tree2c9d4423fac9663a97f290a9f23e5fe40726d2cd
parent8878d9816da7cbf8d0236b7c85f8254719d86613
Fixed Error() instance dumping when "name" prop is not primitive.

Previously, njs_error_to_string2() might be invoked with error argument
pointing to vm->retval.  When "name" prop was not primitive vm->retval
might be overwritten.  As a result error pointer might be referencing a
primitive value.  In turn the second call of njs_object_property()
received an invalid object pointer because it expects only object value
types.

The fix is to ensure that error object pointer is never overwritten.

This closes #615 issue on Github.
src/njs_array.c
src/njs_date.c
src/njs_error.c
src/njs_json.c
src/njs_object.h
src/njs_object_prop.c
src/njs_value.c
src/test/njs_unit_test.c