Skip to content

Commit 0f55a96

Browse files
LiviaMedeirosRafaelGSS
authored andcommitted
crypto: forbid passing Float16Array to getRandomValues()
PR-URL: #57880 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Filip Skokan <panva.ip@gmail.com>
1 parent ec79f76 commit 0f55a96

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

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,

test/wpt/status/WebCryptoAPI.cjs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,6 @@ module.exports = {
1111
'historical.any.js': {
1212
'skip': 'Not relevant in Node.js context',
1313
},
14-
'getRandomValues.any.js': {
15-
'fail': {
16-
'note': 'Node.js does not support Float16Array',
17-
'expected': [
18-
'Float16 arrays',
19-
],
20-
},
21-
},
2214
'sign_verify/eddsa_small_order_points.https.any.js': {
2315
'fail': {
2416
'note': 'see https://github.com/nodejs/node/issues/54572',

test/wpt/test-webcrypto.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// Flags: --js-float16array
2+
// TODO(LiviaMedeiros): once `Float16Array` is unflagged in v8, remove the line above
13
'use strict';
24

35
const common = require('../common');

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy