]> git.kaiwu.me - njs.git/commit
Fixed Array.prototype.sort() when array is changed while sorting.
authorDmitry Volyntsev <xeioex@nginx.com>
Sat, 4 Mar 2023 01:49:11 +0000 (17:49 -0800)
committerDmitry Volyntsev <xeioex@nginx.com>
Sat, 4 Mar 2023 01:49:11 +0000 (17:49 -0800)
commit5f4b5f2713b19ebf4524191309eb81eeb28205e3
tree3f451d65aa1569c199a1bec03b9da419b9618ac6
parent4e29ae2a6d9ec23ec0e7a36f47bf5bd396645b31
Fixed Array.prototype.sort() when array is changed while sorting.

Previously, the fast-path check did not take into account the fact that
the flat array may be resized as a side effect of the array's values
evaluation.

In addition, the slow_path fix ensures that "this" array is repopulated
again even if the array was resized.

This fixes #594 issue on Github.
src/njs_array.c
src/test/njs_unit_test.c