[Pkg-javascript-commits] [uglifyjs] 188/228: minor tweaks to fuzzer (#1751)

Jonas Smedegaard dr at jones.dk
Sat Apr 15 14:25:29 UTC 2017


This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository uglifyjs.

commit 87f6e1b09146607a2bf1eaa080a645277c767dda
Author: Alex Lam S.L <alexlamsl at gmail.com>
Date:   Sat Apr 1 17:09:52 2017 +0800

    minor tweaks to fuzzer (#1751)
    
    - remove `let` as variable name
    - employ `crypto.randomBytes()`
---
 test/ufuzz.js | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/test/ufuzz.js b/test/ufuzz.js
index 4889598..c011ea3 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) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/uglifyjs.git



More information about the Pkg-javascript-commits mailing list