summaryrefslogtreecommitdiff
path: root/ext/crypto/00_crypto.js
diff options
context:
space:
mode:
authorDivy Srivastava <dj.srivastava23@gmail.com>2021-08-13 14:57:56 +0530
committerGitHub <noreply@github.com>2021-08-13 11:27:56 +0200
commitc1f97056f42d20158d469d023652f3b338411007 (patch)
tree0084cd8bee096c97b057e40f70a6b0fa27a8a3ac /ext/crypto/00_crypto.js
parent848137750005e27c7afb0794a51751db3ab5e5fa (diff)
fix(ext/crypto): take a copy of keyData bytes (#11666)
Diffstat (limited to 'ext/crypto/00_crypto.js')
-rw-r--r--ext/crypto/00_crypto.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/ext/crypto/00_crypto.js b/ext/crypto/00_crypto.js
index 449946295..4319f09ba 100644
--- a/ext/crypto/00_crypto.js
+++ b/ext/crypto/00_crypto.js
@@ -463,6 +463,18 @@
context: "Argument 5",
});
+ // 2.
+ if (ArrayBufferIsView(keyData)) {
+ keyData = new Uint8Array(
+ keyData.buffer,
+ keyData.byteOffset,
+ keyData.byteLength,
+ );
+ } else {
+ keyData = new Uint8Array(keyData);
+ }
+ keyData = TypedArrayPrototypeSlice(keyData);
+
const normalizedAlgorithm = normalizeAlgorithm(algorithm, "importKey");
if (