The Wayback Machine - https://web.archive.org/web/20230202221036/https://github.com/nodejs/node/commit/c6436450ee
Skip to content
Permalink
Browse files
crypto: fix error when getRandomValues is called without arguments
PR-URL: #45854
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
  • Loading branch information
panva authored and juanarbol committed Jan 24, 2023
1 parent 5eb93f1 commit c6436450ee1cccaf5c2e92605bf40714f4916c97
Showing 1 changed file with 3 additions and 0 deletions.
@@ -40,6 +40,7 @@ const { Buffer, kMaxLength } = require('buffer');
const {
codes: {
ERR_INVALID_ARG_TYPE,
ERR_MISSING_ARGS,
ERR_OUT_OF_RANGE,
ERR_OPERATION_FAILED,
}
@@ -315,6 +316,8 @@ function onJobDone(buf, callback, error) {
// not allowed to exceed 65536 bytes, and can only
// be an integer-type TypedArray.
function getRandomValues(data) {
if (arguments.length < 1)
throw new ERR_MISSING_ARGS('typedArray');
if (!isTypedArray(data) ||
isFloat32Array(data) ||
isFloat64Array(data)) {

0 comments on commit c643645

Please sign in to comment.
Morty Proxy This is a proxified and sanitized view of the page, visit original site.