]> git.kaiwu.me - njs.git/commit
Fixed Array.prototype.lastIndexOf() with unicode string as "this".
authorDmitry Volyntsev <xeioex@nginx.com>
Wed, 27 Apr 2022 23:31:00 +0000 (16:31 -0700)
committerDmitry Volyntsev <xeioex@nginx.com>
Wed, 27 Apr 2022 23:31:00 +0000 (16:31 -0700)
commiteafe4c7a326b163612f10861392622b5da5b1792
tree1ff60f8be5dc3154f42ec9c6d6605933049226fb
parent982100ba56798dfc487ec9d792ce91916e14c5cc
Fixed Array.prototype.lastIndexOf() with unicode string as "this".

Previously, when lastIndexOf() was called with unicode string as "this"
argument and a negative "fromIndex" argument null-pointer dererence
might occur because njs_string_offset() was called with invalid index
value whereas njs_string_offset() should always be called with valid
index argument.

The fix is to verify that from index is valid.

This closes #482 issue on Github.
src/njs_iterator.c
src/test/njs_unit_test.c