aboutsummaryrefslogtreecommitdiff
path: root/test/ufuzz/index.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2021-01-24 15:37:57 +0000
committerGitHub <noreply@github.com>2021-01-24 23:37:57 +0800
commita08d42555ac42ad1e9bf4b13f44ac46c5bb2dab4 (patch)
treefd8ff5b171a5aa2ce7679e2fbc3018aa72c31391 /test/ufuzz/index.js
parentfd7ad8e7792749c29dec2038bb6cc61cbb7721f1 (diff)
downloadtracifyjs-a08d42555ac42ad1e9bf4b13f44ac46c5bb2dab4.tar.gz
tracifyjs-a08d42555ac42ad1e9bf4b13f44ac46c5bb2dab4.zip
fix infinite recursion in `ufuzz` code generation (#4592)
Diffstat (limited to 'test/ufuzz/index.js')
-rw-r--r--test/ufuzz/index.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/test/ufuzz/index.js b/test/ufuzz/index.js
index a9676fc0..f8d648bc 100644
--- a/test/ufuzz/index.js
+++ b/test/ufuzz/index.js
@@ -1587,9 +1587,10 @@ function getVarName(noConst) {
function createVarName(maybe, dontStore) {
if (!maybe || rng(2)) {
var suffix = rng(3);
- var name;
+ var name, tries = 10;
do {
name = VAR_NAMES[rng(VAR_NAMES.length)];
+ if (--tries < 0) suffix++;
if (suffix) name += "_" + suffix;
} while (unique_vars.indexOf(name) >= 0 || block_vars.indexOf(name) >= 0 || async && name == "await");
if (!dontStore) VAR_NAMES.push(name);