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

ufuzz failure #5884

Closed
alexlamsl opened this issue Jul 15, 2024 · 0 comments · Fixed by #5886
Closed

ufuzz failure #5884

alexlamsl opened this issue Jul 15, 2024 · 0 comments · Fixed by #5886
Labels

Comments

@alexlamsl
Copy link
Collaborator

// original code
// (beautified)
var _calls_ = 10, a = 100, b = 10, c = 0;

try {
    switch ((c = c + 1) + a) {
      default:
        c = c + 1;

      case --b + (typeof f0 == "function" && --_calls_ >= 0 && f0(/[a2][^e]+$/)):
        break;

      case a++ + (typeof a == "function" && --_calls_ >= 0 && a((-42n).toString(), {
            done: typeof a == "function" && --_calls_ >= 0 && a(a += void (("function" && "number") ^ "foo" == 24..toString()), typeof f0 == "function" && --_calls_ >= 0 && f0(22, "foo", /[abc4]/.test(((c = 1 + c, 
            (a && (a.in = -1 - Infinity > ("bar" > ""))) & (NaN + "c" || [ 3n ][0] > 2 <= 5)) || b || 5).toString()))),
            var: a++ + [ --b + (a && typeof a.length == "function" && --_calls_ >= 0 && a.length("function", [])) ].next,
            "-2": b + 1 - .1 - .1 - .1
        })):
        ;
        try {
            (b++ || a || 3).toString();
        } catch (b) {} finally {
            const await_1 = () => {
                if (a++ + (3 in [ typeof a == "function" && --_calls_ >= 0 && a((c = 1 + c, 
                (a && (a[a && typeof a.c == "function" && --_calls_ >= 0 && (c = 1 + c, 
                ((-4 ^ -3) > (25 !== [ , 0 ][1])) - (import.meta % 2 >>> (a = "foo" / [])), 
                a.c)(..."" + a, 24..toString())] = ("" === this) % (a /= true && "foo"))) >> (undefined + 23..toString() === (4 === "undefined")))), --b + (a-- || 3).toString()[((c = 1 + c, 
                -3 * 25 / (null >>> ([ , 0 ].length === 2)) % (a && (a[c = 1 + c, 
                -3 < 38..toString() <= [] % -4 && (a += 23..toString() - 3 < (/[a2][^e]+$/ ^ 25))] |= NaN ^ -4) || (c = c + 1, 
                23..toString()))) || a || 3).toString()] ])) {
                    var b_1 = (c = c + 1) + a++, a_2 = --b + (a_2 && (a_2[(c = c + 1) + (typeof f0 == "function" && --_calls_ >= 0 && f0())] = ({} != 23..toString() && (b_1 && (b_1.NaN = "bar" * 24..toString()))) < (void "undefined" & (a_2 && (a_2.c += 3 >= "a")))));
                }
                {
                    var expr9 = b_1 && b_1[1];
                    for (var key9 in expr9) {
                        c = 1 + c;
                        const await = expr9[key9];
                        c = c + 1;
                    }
                }
            };
            if (typeof await_1 == "function" && --_calls_ >= 0 && await_1(5)) {}
        }
        break;

      case a++:
        {
            var expr13 = b + 1 - .1 - .1 - .1;
            for (a in expr13) {
                try {
                    (c = c + 1) + (a && a[--b + /[a2][^e]+$/]);
                } catch {} finally {
                    a++ + (([ , 0 ].length === 2) >>> false === ([ , 0 ].length === 2) - 0, 
                    (c = c + 1, "number") < (-4 > !0o644n));
                }
            }
        }
        break;
    }
} finally {
    c = c + 1;
    {
        var brake18 = 5;
        do {
            for (var brake19 = 5; a++ + (typeof a == "function" && --_calls_ >= 0 && a`${((c = c + 1) + /[abc4]/g.exec((0 || b || 5).toString()) || a || 3).toString()}${typeof f1 == "function" && --_calls_ >= 0 && f1(--b + /[abc4]/.test(((c = 1 + c, 
            ({} ^ {}) ** (a && ({
                [(c = 1 + c, a && ({
                    in: a[(c = c + 1) + typeof (a && typeof a.static == "function" && --_calls_ >= 0 && (c = 1 + c, 
                    (this && null) >= ("undefined" && 25) || this != "function" == 5 <= true, 
                    a.static)((c = 1 + c, (a && ({
                        1.5: a[a]
                    } = {
                        1.5: ("number" <= "number") / (23..toString() < "foo")
                    })) !== (38..toString() & null) >= (null == null))))]
                } = {
                    in: ([] ^ "b" && (a && (a.foo *= [ , 0 ][1] * "function"))) >= (0 != -4 == ({} ^ "foo"))
                }))]: a[c = 1 + c, (a |= this ^ -2 ^ (a = 1 ^ "a")) || (this ^ 23..toString()) + ("c", 
                "")]
            } = {
                set: null >> false
            })) > (a && (a.b += "" ^ /[a2][^e]+$/), ~!0o644n)) || b || 5).toString()) ? (c = c + 1) + (typeof a == "function" && --_calls_ >= 0 && a((c = 1 + c, 
            ((24..toString() && 0) > delete 23..toString()) - (a && (a.Infinity += (-1 & 4) - (a = "" | -1)))))) : --b + (typeof foo_1 === "symbol"), -2, 22)} `) && brake19 > 0; --brake19) {
                typeof f1 == "function" && --_calls_ >= 0 && f1([ , 0 ].length === 2, "function", this);
            }
        } while ((b = a) && --brake18 > 0);
    }
}

console.log(null, a, b, c, Infinity, NaN, undefined);
// !!! uglify failed !!!
RangeError: Maximum call stack size exceeded
    at TreeTransformer.eval [as before] (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:13779:46)
    at AST_Var.eval [as transform] (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:2899:31)
    at AST_Var.ctor.transform (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:516:34)
    at eval (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:2717:25)
    at List (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:114:23)
    at do_list (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:2716:16)
    at transform_arrow (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:2806:25)
    at AST_Arrow.eval [as transform] (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:2902:13)
    at AST_Arrow.ctor.transform (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:516:34)
    at eval (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:2788:49)
    at AST_VarDef.eval [as transform] (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:2902:13)
    at AST_VarDef.ctor.transform (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:516:34)
    ...
    at eval (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:2717:25)
    at List (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:114:23)
    at do_list (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:2716:16)
    at eval (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:2730:21)
    at descend_scope (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:14260:17)
    at TreeTransformer.eval [as before] (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:14249:17)
    at AST_Toplevel.eval [as transform] (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:2899:31)
    at AST_Toplevel.ctor.transform (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:516:34)
    at AST_Toplevel.eval [as drop_unused] (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:14304:14)
    at Compressor.eval (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:6603:13)
    at AST_Toplevel.eval [as transform] (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:2899:31)
    at AST_Toplevel.ctor.transform (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:516:34)
    at Compressor.compress (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:6636:21)
    at Object.minify (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:25022:57)
    at /home/runner/work/UglifyJS/UglifyJS/test/ufuzz/index.js:2567:32
    at Array.forEach (<anonymous>)
    at Object.<anonymous> (/home/runner/work/UglifyJS/UglifyJS/test/ufuzz/index.js:2559:20)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
    at internal/main/run_main_module.js:17:47
// reduced test case (output will differ)

// (beautified)
try {
    {
        const await_1 = () => {
            var expr9;
            for (var key9 in expr9) {
                const await = expr9[0];
            }
        };
        await_1 && await_1();
    }
} finally {
    for (var brake19 = 5; brake19; --brake19) {}
}
// minify error: RangeError: Maximum call stack size exceeded
//     at assign_as_unused (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:13471:105)
//     at TreeTransformer.eval [as before] (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:13782:39)
//     at AST_VarDef.eval [as transform] (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:2899:31)
//     at AST_VarDef.ctor.transform (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:516:34)
//     at eval (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:2717:25)
//     at List (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:114:23)
//     at do_list (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:2716:16)
//     at eval (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:2784:28)
//     at AST_Var.eval [as transform] (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:2902:13)
//     at AST_Var.ctor.transform (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:516:34)
//     ...
//     at eval (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:2717:25)
//     at List (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:114:23)
//     at do_list (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:2716:16)
//     at transform_arrow (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:2806:25)
//     at descend_scope (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:14260:17)
//     at TreeTransformer.eval [as before] (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:13871:17)
//     at AST_Arrow.eval [as transform] (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:2899:31)
//     at AST_Arrow.ctor.transform (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:516:34)
//     at eval (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:13981:58)
//     at Array.forEach (<anonymous>)
//     at TreeTransformer.eval [as before] (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:13980:34)
//     at AST_Var.eval [as transform] (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:2899:31)
//     at AST_Var.ctor.transform (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:516:34)
//     at eval (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:2717:25)
//     at List (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:114:23)
//     at do_list (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:2716:16)
//     at eval (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:2775:21)
//     at AST_Try.eval [as transform] (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:2902:13)
//     at AST_Try.ctor.transform (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:516:34)
//     at eval (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:2717:25)
//     at List (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:114:23)
//     at do_list (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:2716:16)
//     at eval (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:2730:21)
//     at descend_scope (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:14260:17)
//     at TreeTransformer.eval [as before] (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:14249:17)
//     at AST_Toplevel.eval [as transform] (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:2899:31)
//     at AST_Toplevel.ctor.transform (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:516:34)
//     at AST_Toplevel.eval [as drop_unused] (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:14304:14)
//     at Compressor.eval (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:6603:13)
//     at AST_Toplevel.eval [as transform] (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:2899:31)
//     at AST_Toplevel.ctor.transform (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:516:34)
//     at Compressor.compress (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:6636:21)
//     at Object.minify (eval at <anonymous> (/home/runner/work/UglifyJS/UglifyJS/tools/node.js:1:1), <anonymous>:25022:57)
//     at test_minify (/home/runner/work/UglifyJS/UglifyJS/test/reduce.js:823:22)
//     at reduce_test (/home/runner/work/UglifyJS/UglifyJS/test/reduce.js:650:16)
//     at log (/home/runner/work/UglifyJS/UglifyJS/test/ufuzz/index.js:2265:23)
//     at /home/runner/work/UglifyJS/UglifyJS/test/ufuzz/index.js:2644:80
//     at Array.forEach (<anonymous>)
//     at Object.<anonymous> (/home/runner/work/UglifyJS/UglifyJS/test/ufuzz/index.js:2559:20)
//     at Module._compile (internal/modules/cjs/loader.js:999:30)
//     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
//     at Module.load (internal/modules/cjs/loader.js:863:32)
//     at Function.Module._load (internal/modules/cjs/loader.js:708:14)
//     at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
//     at internal/main/run_main_module.js:17:47
// options: {
//   "compress": {
//     "hoist_vars": true,
//     "keep_infinity": true,
//     "passes": 1000000,
//     "unsafe": true
//   },
//   "keep_fargs": true,
//   "keep_fnames": true,
//   "module": false,
//   "toplevel": true,
//   "output": {
//     "v8": true
//   },
//   "validate": true
// }
minify(options):
{
  "compress": {
    "hoist_vars": true,
    "keep_infinity": true,
    "passes": 1000000,
    "unsafe": true
  },
  "keep_fargs": true,
  "keep_fnames": true,
  "module": false,
  "toplevel": true,
  "output": {
    "v8": true
  }
}

Suspicious compress options:
  arrows
  conditionals
  evaluate
  hoist_vars
  inline
  join_vars
  passes
  reduce_vars
  sequences
  unused
  varify

Suspicious options:
  toplevel
@alexlamsl alexlamsl added the bug label Jul 15, 2024
alexlamsl added a commit to alexlamsl/UglifyJS that referenced this issue Jul 15, 2024
alexlamsl added a commit that referenced this issue Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant