Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f1bc994

Browse filesBrowse files
kylo5abytargos
authored andcommitted
buffer: remove lines setting indexes to integer value
PR-URL: #52588 Refs: #52585 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 15aad62 commit f1bc994
Copy full SHA for f1bc994

File tree

Expand file treeCollapse file tree

2 files changed

+21
-2
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+21
-2
lines changed
Open diff view settings
Collapse file

‎lib/internal/blob.js‎

Copy file name to clipboardExpand all lines: lib/internal/blob.js
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,14 +243,12 @@ class Blob {
243243
} else {
244244
start = MathMin(start, this[kLength]);
245245
}
246-
start |= 0;
247246

248247
if (end < 0) {
249248
end = MathMax(this[kLength] + end, 0);
250249
} else {
251250
end = MathMin(end, this[kLength]);
252251
}
253-
end |= 0;
254252

255253
contentType = `${contentType}`;
256254
if (RegExpPrototypeExec(disallowedTypeCharacters, contentType) !== null) {
Collapse file
+21Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
'use strict';
2+
const common = require('../common');
3+
4+
// Buffer with size > INT32_MAX
5+
common.skipIf32Bits();
6+
7+
const assert = require('assert');
8+
9+
const size = 2 ** 31;
10+
11+
try {
12+
const buf = Buffer.allocUnsafe(size);
13+
const blob = new Blob([buf]);
14+
const slicedBlob = blob.slice(size - 1, size);
15+
assert.strictEqual(slicedBlob.size, 1);
16+
} catch (e) {
17+
if (e.code !== 'ERR_MEMORY_ALLOCATION_FAILED') {
18+
throw e;
19+
}
20+
common.skip('insufficient space for Buffer.allocUnsafe');
21+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.