mirror of
https://github.com/nodejs/node.git
synced 2025-04-28 05:25:19 +00:00
crypto: forbid passing Float16Array
to getRandomValues()
PR-URL: https://github.com/nodejs/node/pull/57880 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Filip Skokan <panva.ip@gmail.com>
This commit is contained in:
parent
e61937b82c
commit
c11c7be36e
@ -57,6 +57,7 @@ const {
|
||||
isArrayBufferView,
|
||||
isAnyArrayBuffer,
|
||||
isTypedArray,
|
||||
isFloat16Array,
|
||||
isFloat32Array,
|
||||
isFloat64Array,
|
||||
} = require('internal/util/types');
|
||||
@ -315,6 +316,7 @@ function onJobDone(buf, callback, error) {
|
||||
// be an integer-type TypedArray.
|
||||
function getRandomValues(data) {
|
||||
if (!isTypedArray(data) ||
|
||||
isFloat16Array(data) ||
|
||||
isFloat32Array(data) ||
|
||||
isFloat64Array(data)) {
|
||||
// Ordinarily this would be an ERR_INVALID_ARG_TYPE. However,
|
||||
|
@ -11,14 +11,6 @@ module.exports = {
|
||||
'historical.any.js': {
|
||||
'skip': 'Not relevant in Node.js context',
|
||||
},
|
||||
'getRandomValues.any.js': {
|
||||
'fail': {
|
||||
'note': 'Node.js does not support Float16Array',
|
||||
'expected': [
|
||||
'Float16 arrays',
|
||||
],
|
||||
},
|
||||
},
|
||||
'sign_verify/eddsa_small_order_points.https.any.js': {
|
||||
'fail': {
|
||||
'note': 'see https://github.com/nodejs/node/issues/54572',
|
||||
|
@ -1,3 +1,5 @@
|
||||
// Flags: --js-float16array
|
||||
// TODO(LiviaMedeiros): once `Float16Array` is unflagged in v8, remove the line above
|
||||
'use strict';
|
||||
|
||||
const common = require('../common');
|
||||
|
Loading…
Reference in New Issue
Block a user