diff --git a/lib/internal/buffer.js b/lib/internal/buffer.js index 60f6cab093135d..3515626041bbad 100644 --- a/lib/internal/buffer.js +++ b/lib/internal/buffer.js @@ -949,7 +949,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;