diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2017-04-01 17:09:52 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-01 17:09:52 +0800 |
commit | 87f6e1b09146607a2bf1eaa080a645277c767dda (patch) | |
tree | 9f023c0b4cfaf83e24fe3b3f0464eb36604b92e0 /test | |
parent | c934fc81426b0f896d23499f50ba3e86fe9d7725 (diff) | |
download | tracifyjs-87f6e1b09146607a2bf1eaa080a645277c767dda.tar.gz tracifyjs-87f6e1b09146607a2bf1eaa080a645277c767dda.zip |
minor tweaks to fuzzer (#1751)
- remove `let` as variable name
- employ `crypto.randomBytes()`
Diffstat (limited to 'test')
-rw-r--r-- | test/ufuzz.js | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/test/ufuzz.js b/test/ufuzz.js index 4889598b..c011ea36 100644 --- a/test/ufuzz.js +++ b/test/ufuzz.js @@ -13,6 +13,7 @@ }); var minify = require("..").minify; +var randomBytes = require("crypto").randomBytes; var sandbox = require("./sandbox"); var MAX_GENERATED_TOPLEVELS_PER_RUN = 3; @@ -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 = [ @@ -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) { |