]> git.kaiwu.me - njs.git/commit
Fixed allocation of large array literals.
authorDmitry Volyntsev <xeioex@nginx.com>
Mon, 21 Feb 2022 16:53:16 +0000 (16:53 +0000)
committerDmitry Volyntsev <xeioex@nginx.com>
Mon, 21 Feb 2022 16:53:16 +0000 (16:53 +0000)
commitf65981b0b8fcf02d69a40bc934803c25c9f607ab
treeccbc1b21efa013a15bed2b7e7b915949f4e725d1
parentad48705bf1f04b4221a5f5b07715ac48b3160d53
Fixed allocation of large array literals.

Previously, allocation of large array literals may result in
null-pointer dereference. The reason is that njs_array_alloc() may
return a slow array when size is large enough, but the instruction
code assumes that array is always flat.

The fix is to check fast_array flag before accessing array->start.

This closes #473 issue on Github.
src/njs_vmcode.c
src/test/njs_unit_test.c