File tree 2 files changed +21
-2
lines changed
2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -243,14 +243,12 @@ class Blob {
243
243
} else {
244
244
start = MathMin ( start , this [ kLength ] ) ;
245
245
}
246
- start |= 0 ;
247
246
248
247
if ( end < 0 ) {
249
248
end = MathMax ( this [ kLength ] + end , 0 ) ;
250
249
} else {
251
250
end = MathMin ( end , this [ kLength ] ) ;
252
251
}
253
- end |= 0 ;
254
252
255
253
contentType = `${ contentType } ` ;
256
254
if ( RegExpPrototypeExec ( disallowedTypeCharacters , contentType ) !== null ) {
Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments