Skip to content

Commit 16ae2b2

Browse files
kylo5abymarco-ippolito
authored andcommitted
buffer: remove lines setting indexes to integer value
PR-URL: #52588 Refs: #52585 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 1dce5de commit 16ae2b2

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

‎lib/internal/blob.js‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,14 +244,12 @@ class Blob{
244244
}else{
245245
start=MathMin(start,this[kLength]);
246246
}
247-
start|=0;
248247

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

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

0 commit comments

Comments
(0)