Skip to content

Commit 3ea6daf

Browse files
Fix PullInto() reading stale byteLength after transferring
1 parent d68a5c7 commit 3ea6daf

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

reference-implementation/lib/abstract-ops/readable-streams.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1584,6 +1584,8 @@ function ReadableByteStreamControllerPullInto(controller, view, min, readIntoReq
15841584
assert(minimumFill >= elementSize && minimumFill <= view.byteLength);
15851585
assert(minimumFill % elementSize === 0);
15861586

1587+
const byteOffset = view.byteOffset;
1588+
const byteLength = view.byteLength;
15871589
const ctor = view.constructor;
15881590

15891591
let buffer;
@@ -1597,8 +1599,8 @@ function ReadableByteStreamControllerPullInto(controller, view, min, readIntoReq
15971599
const pullIntoDescriptor = {
15981600
buffer,
15991601
bufferByteLength: buffer.byteLength,
1600-
byteOffset: view.byteOffset,
1601-
byteLength: view.byteLength,
1602+
byteOffset,
1603+
byteLength,
16021604
bytesFilled: 0,
16031605
minimumFill,
16041606
elementSize,

0 commit comments

Comments
 (0)