]> git.kaiwu.me - njs.git/commit
DataView: fix copy-on-write in set methods
authorDmitry Volyntsev <xeioex@nginx.com>
Fri, 30 Oct 2026 01:50:51 +0000 (18:50 -0700)
committerDmitry Volyntsev <xeioexception@gmail.com>
Mon, 2 Nov 2026 14:42:35 +0000 (06:42 -0800)
commit87e2d83a53d14b4d56450628642bf3d2d8afb9d1
tree8032207c15f748496144f01138deaeef214e50f8
parent1995b610fd2a298a6a7bd15723701995b6c8fd87
DataView: fix copy-on-write in set methods

Previously, DataView.prototype.setXXX() wrote directly into the
underlying ArrayBuffer without making a private copy of shared data.
As a result, writing through a DataView over r.requestBuffer in nginx
modified the request body seen by subsequent reads.

Now, the buffer is made writable before the write, as is done for
typed arrays.

The issue was introduced in 409004cb (0.4.4).
src/njs_typed_array.c
src/test/njs_unit_test.c