mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
bf8afe7644
PR-URL: https://github.com/nodejs/node/pull/52588 Refs: https://github.com/nodejs/node/issues/52585 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
22 lines
479 B
JavaScript
22 lines
479 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
|
|
// Buffer with size > INT32_MAX
|
|
common.skipIf32Bits();
|
|
|
|
const assert = require('assert');
|
|
|
|
const size = 2 ** 31;
|
|
|
|
try {
|
|
const buf = Buffer.allocUnsafe(size);
|
|
const blob = new Blob([buf]);
|
|
const slicedBlob = blob.slice(size - 1, size);
|
|
assert.strictEqual(slicedBlob.size, 1);
|
|
} catch (e) {
|
|
if (e.code !== 'ERR_MEMORY_ALLOCATION_FAILED') {
|
|
throw e;
|
|
}
|
|
common.skip('insufficient space for Buffer.allocUnsafe');
|
|
}
|