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

minor tweaks to fuzzer #1751

Merged
merged 1 commit into from Apr 1, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions test/ufuzz.js
Expand Up @@ -13,6 +13,7 @@
});

var minify = require("..").minify;
var randomBytes = require("crypto").randomBytes;
var sandbox = require("./sandbox");

var MAX_GENERATED_TOPLEVELS_PER_RUN = 3;
Expand Down Expand Up @@ -252,8 +253,7 @@ var VAR_NAMES = [
'decodeURIComponent',
'encodeURI',
'encodeURIComponent',
'Object',
'let' ]; // maybe omit this, it's more a parser problem than minifier
'Object'];
var INITIAL_NAMES_LEN = VAR_NAMES.length;

var TYPEOF_OUTCOMES = [
Expand All @@ -271,7 +271,8 @@ var loops = 0;
var funcs = 0;

function rng(max) {
return Math.floor(max * Math.random());
var r = parseInt(randomBytes(4).toString("hex"), 16) / 0xFFFFFFFF;
return Math.floor(max * r);
}

function createTopLevelCodes(n) {
Expand Down