Skip to content

Commit bce9423

Browse files
committed
crypto: forbid passing Float16Array to getRandomValues()
1 parent b2405e9 commit bce9423

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

lib/internal/crypto/random.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ const {
5757
isArrayBufferView,
5858
isAnyArrayBuffer,
5959
isTypedArray,
60+
isFloat16Array,
6061
isFloat32Array,
6162
isFloat64Array,
6263
} = require('internal/util/types');
@@ -315,6 +316,7 @@ function onJobDone(buf, callback, error) {
315316
// be an integer-type TypedArray.
316317
function getRandomValues(data) {
317318
if (!isTypedArray(data) ||
319+
isFloat16Array(data) ||
318320
isFloat32Array(data) ||
319321
isFloat64Array(data)) {
320322
// Ordinarily this would be an ERR_INVALID_ARG_TYPE. However,

0 commit comments

Comments
 (0)