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 #5195

Closed
alexlamsl opened this issue Nov 24, 2021 · 0 comments · Fixed by #5196
Closed

ufuzz failure #5195

alexlamsl opened this issue Nov 24, 2021 · 0 comments · Fixed by #5196
Labels

Comments

@alexlamsl
Copy link
Collaborator

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

function f0(foo_1, b_2, bar_2) {
    {
        var expr1 = b_2;
        for (var key1 in expr1) {
            c = 1 + c;
            var await = expr1[key1];
            {
                var brake2 = 5;
                do {
                    var foo_2 = {
                        bar_2: bar_2,
                        null: key1,
                        then: a++ + (typeof key1 == "function" && --_calls_ >= 0 && key1("a", this, 38..toString())),
                        done: (c = c + 1) + {
                            then: b = a,
                            "\t": (c = c + 1) + {
                                NaN: (c = 1 + c, (-5 !== "a") - undefined * {} < ((bar_2 && (bar_2.a = -1 - NaN)) === -0 >>> "function")),
                                foo_1: foo_1,
                                0: (c = 1 + c, -2 > "undefined" != (c = c + 1, 1) == ("foo" ^ 2, "bar" < -3)),
                                null: (c = 1 + c, (38..toString() !== -2 && -4 > "undefined") - (5 > 5 != undefined >>> true))
                            }.length,
                            ...key1
                        }.async,
                        b: {
                            [(c = c + 1) + [ (c = 1 + c, ("bar" | -5) + (key1 && (key1.undefined += [ , 0 ][1] ^ NaN)) || (0 == "number") * (24..toString() % "number")), (c = 1 + c, 
                            (-4 >> -4) % (/[a2][^e]+$/ <= -2) !== (4 === [ , 0 ][1]) >> (38..toString() >>> 22)), (c = 1 + c, 
                            (c = c + 1, 4 <= this) % ((-3 != 2) >>> (foo_1 && (foo_1[c = 1 + c, ({} ^ undefined) - ("number" << 1) - (foo_1 && (foo_1.in = "bar" + "c") || {} + "object")] = [] == "number")))), (c = 1 + c, 
                            (22 << {} ^ "a" + /[a2][^e]+$/) - ("b" >>> ([ , 0 ].length === 2) | (0, undefined))) ]]: a++ + bar_2,
                            a: b -= a
                        }.static
                    };
                } while ((c = c + 1) + (foo_2 += void a) && --brake2 > 0);
            }
        }
    }
    return +((bar_2 && (bar_2[((-0 ^ NaN) << (3 >>> 4)) + !("c" + 23..toString())] = ("b" ^ 3) & (-5 ^ 25))) | this >= 25 ^ (c = c + 1, 
    "a"));
}

var Infinity_1 = f0({
    [--b + typeof ++a]: (c = c + 1) + (24..toString() in [ -0 in [ 2 ] ]),
    3: Infinity_1 && Infinity_1[(c = c + 1) + []],
    Infinity: 0 === 1 ? a : b
}.Infinity, ..."" + Infinity_1);

console.log(null, a, b, c, Infinity, NaN, undefined);
// uglified code
// (beautified)
var r = 10, N = 100, l = 10, c = 0, n = function f0(n, i, o) {
    var t, f, a, e = i;
    for (t in e) {
        for (c = 1 + c, e[t], f = 5; N++, "function" == typeof t && 0 <= --r && t("a", this, "38"), 
        c += 1, {
            then: l = N,
            "\t": (c += 1) + {
                NaN: (c = 1 + c, NaN < (0 === (o && (o.a = NaN)))),
                foo_1: n,
                0: (c = 1 + c, !1),
                null: (c = 1 + (c + 1), 0)
            }.length,
            ...t
        }.async, c += 1, c = 1 + c, t && (t.undefined += 0), c = 1 + (1 + c), c += 1, n && (n[c = 1 + c, 
        0 - (n ? n.in = "barc" : {} + "object")] = !1), c = 1 + c, N++, l -= N, (c += 1) + (a += void 0) && 0 < --f; ) {}
    }
    return +((o && (o[0] = 2)) | 25 <= this ^ (c += 1, "a"));
}({
    [--l + typeof ++N]: (c += 1) + ("24" in [ !0 ]),
    3: n && n[(c += 1) + []],
    Infinity: l
}.Infinity, ..."" + n);

console.log(null, N, l, c, Infinity, NaN, void 0);

export {
    r as _calls_,
    N as a,
    l as b,
    c
};
original result:
null 111 -1 73 Infinity NaN undefined

uglified result:
null 103 -1 17 Infinity NaN undefined
// reduced test case (output will differ)

// (beautified)
function f0(b_2, bar_2) {
    var expr1 = 0;
    do {
        var foo_2 = {
            b: bar_2
        };
    } while (foo_2 += 0);
}

f0();
// output: Error: Script execution timed out.
// minify: 
// options: {
//   "compress": {
//     "hoist_vars": true,
//     "keep_infinity": true,
//     "passes": 1000000,
//     "unsafe": true
//   },
//   "keep_fnames": true,
//   "toplevel": true,
//   "mangle": {
//     "v8": true
//   },
//   "output": {
//     "v8": true
//   },
//   "validate": true
// }
minify(options):
{
  "compress": {
    "hoist_vars": true,
    "keep_infinity": true,
    "passes": 1000000,
    "unsafe": true
  },
  "keep_fnames": true,
  "toplevel": true,
  "mangle": {
    "v8": true
  },
  "output": {
    "v8": true
  }
}

Suspicious compress options:
  hoist_props
  hoist_vars
  reduce_vars
  side_effects
  unused

Suspicious options:
  toplevel
@alexlamsl alexlamsl added the bug label Nov 24, 2021
alexlamsl added a commit to alexlamsl/UglifyJS that referenced this issue Nov 24, 2021
alexlamsl added a commit that referenced this issue Nov 24, 2021
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