Skip to content
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

Replaced library_fs.js/random_device()'s Math.random fallback call with throw for safety #7096

Merged
merged 3 commits into from
Sep 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -358,3 +358,4 @@ a license to everyone to use it as detailed in LICENSE.)
* Alexander Frank Lehmann <[email protected]> (copyright owned by Compusoft Group)
* Tommy Nguyen <[email protected]>
* Benjamin S. Rodgers <[email protected]>
* Paul Shapiro <[email protected]>
2 changes: 1 addition & 1 deletion src/library_fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -1301,7 +1301,7 @@ mergeInto(LibraryManager.library, {
#endif // ENVIRONMENT_MAY_BE_NODE
} else {
// default for ES5 platforms
random_device = function() { return (Math.random()*256)|0; };
random_device = function() { abort("random_device"); /*Math.random() is not safe for random number generation, so this fallback random_device implementation aborts... see kripken/emscripten/pull/7096 */ };
}
FS.createDevice('/dev', 'random', random_device);
FS.createDevice('/dev', 'urandom', random_device);
Expand Down