]> git.kaiwu.me - njs.git/commit
Fixed typed-array ctor when source array is changed while iterating.
authorDmitry Volyntsev <xeioex@nginx.com>
Sat, 4 Jun 2022 06:24:08 +0000 (23:24 -0700)
committerDmitry Volyntsev <xeioex@nginx.com>
Sat, 4 Jun 2022 06:24:08 +0000 (23:24 -0700)
commit86c2c8270240d0a7a1bc4757fd2010fd989e8037
treea52c4dc77aaf3fd1379ccc450a7876ee47744d5a
parentd09868bc71f9a990445959329ad8c1b10d3898f5
Fixed typed-array ctor when source array is changed while iterating.

Previously, the function used optimization for ordinary arrays with no
gaps (so called fast arrays).  For a fast array code took elements
directly from internal flat C array. The direct pointer may become
invalid as side-effect of custom valueOf() method for an element.

The fix is to eliminate the micro-optimization which uses direct
pointers.

The problem is similar to the 9578cc729205 (0.7.2) commit.

This closes #523 issue on Github.
src/njs_typed_array.c