Skip to content

Commit

Permalink
fix: Fill correct view region in crypto.getRandomValues (#1659)
Browse files Browse the repository at this point in the history
  • Loading branch information
dcodeIO committed Feb 3, 2021
1 parent 1188b8a commit cc37cc4
Show file tree
Hide file tree
Showing 4 changed files with 1,749 additions and 878 deletions.
2 changes: 1 addition & 1 deletion std/assembly/crypto.ts
Expand Up @@ -5,7 +5,7 @@ import {

export namespace crypto {
export function getRandomValues(array: Uint8Array): void {
var err = random_get(changetype<usize>(array.buffer), <usize>array.byteLength);
var err = random_get(changetype<usize>(array.buffer) + <usize>array.byteOffset, <usize>array.byteLength);
if (err) throw new Error(errnoToString(err));
}
}

0 comments on commit cc37cc4

Please sign in to comment.