Skip to content

Commit bf9de3d

Browse files
committed
test: restore typed-array instrumentation without prototype pollution
1 parent 37f37c8 commit bf9de3d

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

‎test/test_export.js‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,16 +115,17 @@ exports.test = function(SQL, assert) {
115115
let largeBytes;
116116
try {
117117
large.run('CREATE TABLE t(data); INSERT INTO t VALUES (zeroblob(3145728))');
118-
const set = Uint8Array.prototype.set;
118+
const prototype = Object.getPrototypeOf(Uint8Array.prototype);
119+
const set = prototype.set;
119120
let largestCopy = 0;
120-
Uint8Array.prototype.set = function(source, offset) {
121+
prototype.set = function(source, offset) {
121122
largestCopy = Math.max(largestCopy, source.length);
122123
return set.call(this, source, offset);
123124
};
124125
try {
125126
largeBytes = large.export();
126127
} finally {
127-
Uint8Array.prototype.set = set;
128+
prototype.set = set;
128129
}
129130
assert.ok(largestCopy <= 65536,
130131
'Export never copies a growing file or a full-size result array');

0 commit comments

Comments
 (0)