diff options
author | Marcos Casagrande <marcoscvp90@gmail.com> | 2022-10-14 11:38:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-14 11:38:17 +0200 |
commit | 0d6dbc08bec50aa1548703bf53dc632e0aeefbd6 (patch) | |
tree | ccf55e35bfc94895f9513c7f5b5189e2177f9aff /ext/web/06_streams.js | |
parent | 50c7b893692fb6563952ab18ef8ad0f682944976 (diff) |
fix(ext/fetch): throw TypeError on non-Uint8Array chunk (#16262)
Diffstat (limited to 'ext/web/06_streams.js')
-rw-r--r-- | ext/web/06_streams.js | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/ext/web/06_streams.js b/ext/web/06_streams.js index 933d7b09c..361e5e055 100644 --- a/ext/web/06_streams.js +++ b/ext/web/06_streams.js @@ -813,6 +813,12 @@ const { value: chunk, done } = await reader.read(); if (done) break; + if (!ObjectPrototypeIsPrototypeOf(Uint8ArrayPrototype, chunk)) { + throw new TypeError( + "Can't convert value to Uint8Array while consuming the stream", + ); + } + ArrayPrototypePush(chunks, chunk); totalLength += chunk.byteLength; } |