-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
crypto.randomFill : error with TypedArray #38137
Comments
Yep, you're right. I've got a fix just about ready. |
I've a solution that seems work : arkerone@77bbef8 |
@arkerone Thank you for bug report. Your PR #38131 may reveal an intricate bug that in calling node/lib/internal/crypto/random.js Line 168 in 038608d
Since Your solution arkerone@77bbef8 seems making |
I thought that |
Yes, it seems so. Thank you for kind correction. |
PR Here: #38138 |
Refs: #38137 PR-URL: #38150 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: James M Snell <[email protected]>
Refs: #38137 PR-URL: #38150 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: James M Snell <[email protected]>
I've opened a PR about a typo bug : #38131
But I think that I found a bug.
What steps will reproduce the bug?
Run this code :
How often does it reproduce? Is there a required condition?
Always with the code above or TypedArray with size element > 1 Byte
What is the expected behavior?
a buffer fill with random bytes
What do you see instead?
I got this error :
RangeError [ERR_OUT_OF_RANGE]: The value of "size + offset" is out of range. It must be <= 20. Received 40
Additional information
I think there a problem with the
assertSize
function because the first param is the number of element but we pass the number of bytes (ie:buf.byteLength
). TheassertSize
function must be called only when the size parameter is passed to therandomFill
function.I can open a PR if the issue is confirmed : arkerone@77bbef8
The text was updated successfully, but these errors were encountered: