Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c643645

Browse filesBrowse files
panvajuanarbol
authored andcommitted
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>
1 parent 5eb93f1 commit c643645
Copy full SHA for c643645

File tree

Expand file treeCollapse file tree

1 file changed

+3
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-0
lines changed
Open diff view settings
Collapse file

‎lib/internal/crypto/random.js‎

Copy file name to clipboardExpand all lines: lib/internal/crypto/random.js
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ const { Buffer, kMaxLength } = require('buffer');
4040
const {
4141
codes: {
4242
ERR_INVALID_ARG_TYPE,
43+
ERR_MISSING_ARGS,
4344
ERR_OUT_OF_RANGE,
4445
ERR_OPERATION_FAILED,
4546
}
@@ -315,6 +316,8 @@ function onJobDone(buf, callback, error) {
315316
// not allowed to exceed 65536 bytes, and can only
316317
// be an integer-type TypedArray.
317318
function getRandomValues(data) {
319+
if (arguments.length < 1)
320+
throw new ERR_MISSING_ARGS('typedArray');
318321
if (!isTypedArray(data) ||
319322
isFloat32Array(data) ||
320323
isFloat64Array(data)) {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.