diff --git a/lib/internal/buffer.js b/lib/internal/buffer.js index c254a0277d15d9..dd27c15957f1ac 100644 --- a/lib/internal/buffer.js +++ b/lib/internal/buffer.js @@ -948,7 +948,14 @@ function writeFloatBackwards(val, offset = 0) { return offset; } -class FastBuffer extends Uint8Array {} +class FastBuffer extends Uint8Array { + // Using an explicit constructor here is necessary to avoid relying on + // `Array.prototype[Symbol.iterator]`, which can be mutated by users. + // eslint-disable-next-line no-useless-constructor + constructor(bufferOrLength, byteOffset, length) { + super(bufferOrLength, byteOffset, length); + } +} function addBufferPrototypeMethods(proto) { proto.readBigUInt64LE = readBigUInt64LE;