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

Closed
alexlamsl opened this issue Jan 4, 2023 · 0 comments · Fixed by #5771
Closed

ufuzz failure #5770

alexlamsl opened this issue Jan 4, 2023 · 0 comments · Fixed by #5771
Labels

Comments

@alexlamsl
Copy link
Collaborator

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

function f0(b_1_2, b_1) {
    {
        var brake1 = 5;
        L28635: do {
            if ([ --b + [ b_1_2 ].set ]) {
                if (--b + (Number(0xdeadn << 16n | 0xbeefn) in {
                    b_1: b_1,
                    1.5: --b + {
                        Infinity: (c = 1 + c, -(b_1 = "undefined" == NaN && 38..toString() > ([ , 0 ].length === 2)))
                    }[typeof (c = 1 + c, b_1_2 = (NaN << "bar" | (24..toString() || Infinity), 
                    "object" * -0 ^ "bar" << "undefined"))]
                })) {
                    L28636: for (var brake5 = 5; (c = c + 1) + b-- && brake5 > 0; --brake5) {
                        continue L28635;
                    }
                } else {}
                c = c + 1;
                L28637: {}
                {
                    var a = function b_1_2(arguments_2, b_1_2_2 = (b_1_2 *= -3 * 24..toString() == -5 <= -5) === (b_1_2 && (b_1_2.undefined = -4 && "c" || +null)), a_1) {
                        function f1(yield_1, b_2, Infinity_1) {
                            c = 1 + c, ("bar" > "object") * (-1) ** 38..toString() != ((b_1 = "object" !== this) && false == null);
                        }
                        var b_1_2_1 = f1();
                        function f2(b_1_2_1, yield) {
                            c = 1 + c, (arguments_2 && (arguments_2.done = -0 !== {})) >>> (1 === /[a2][^e]+$/) == ((b_1_2_2 && (b_1_2_2[c = 1 + c, 
                            (c = c + 1, -3 == -1) < ({} >> 25 && undefined & null)] += "bar" * 25)) === (true === "bar"));
                        }
                        var foo_2 = f2("bar", --b + {
                            ...b_1,
                            next: (c = 1 + c, (4 ^ [ 3n ][0] > 2) << (undefined ^ -4) & ((b_1_2 && (b_1_2.Infinity = [ , 0 ].length === 2 == this)) ^ "number" + "")),
                            NaN: (c = 1 + c, (c = c + 1, /[a2][^e]+$/, -0) != (0 !== /[a2][^e]+$/) > (-1 ^ 38..toString()))
                        }[c = 1 + c, (arguments_2 += (-4 < this) + (-1) ** [ , 0 ][1]) + void +([ , 0 ].length === 2)]);
                    }("b" in [], null);
                }
            } else {
                switch (a++ + [ ..."" + b_1_2, ..."" + b_1, (c = c + 1) + {
                    "\t": --b + (null in {})
                }[--b + (typeof b_1 == "function" && --_calls_ >= 0 && b_1("bar"))], "function" in {
                    b: [ (c = 1 + c, b_1 && (b_1[a++ + [ , 0 ][1]] <<= (3 + 5) * (-4) ** "a" === this >>> "" >> ("foo" || 3))), (c = 1 + c, 
                    c = c + 1, null > [] ^ (3 ^ -0)) ][{
                        done: (c = 1 + c, "" + -5 - {} % -3 << ("" >> 23..toString() <= {} - 24..toString())),
                        then: (c = 1 + c, ("foo" <= "foo" == "object" < "b") >>> (0 <= "a") - (5 + -5))
                    }[c = 1 + c, (c = c + 1, "object") % (false - 4) == -4 <= true <= ("undefined" | "bar")]],
                    ...typeof b_1 == "function" && --_calls_ >= 0 && b_1(),
                    in: typeof (1 === 1 ? a : b),
                    set: (c = c + 1) + (b_1_2 && b_1_2[--b + [ (c = 1 + c, ("" && "a") / (NaN >> "") % (([ , 0 ][1] < 0) + -0 % 4)), (c = 1 + c, 
                    (null ** this == (-0 == {})) - (!0o644n == "number" == false << "")), (c = 1 + c, 
                    (false + "c", this === []) & (b_1_2 && (b_1_2[--b + /[abc4]/.test(((c = 1 + c, 
                    void ((-3 == 5) > (-3 || "b"))) || b || 5).toString())] %= (5 < 23..toString()) * (2 + -1)))) ]]),
                    "\t": -(("a" >> -1 ^ false === 23..toString()) != ([] >>> 3 ^ "number" & [ , 0 ][1]))
                }, a++ + (([] == 23..toString()) >>> (25 >>> true), ("bar", "") >> (-2 << ([ , 0 ].length === 2))) ].value) {
                  case 0 === 1 ? a : b:
                    break;

                  default:
                  case {}.undefined:
                  case --b + b_1:
                    for (var brake14 = 5; --b + (b_1 && b_1.static) && brake14 > 0; --brake14) {
                        c = c + 1;
                    }
                    break;
                }
            }
        } while (a++ + ((c = c + 1, 24..toString() >= 4) && (23..toString(), []) & -5 != /[a2][^e]+$/) && --brake1 > 0);
    }
}

var b_1 = f0(false, a && typeof a.next == "function" && --_calls_ >= 0 && a.next(a++ + (0 === 1 ? a : b)), {});

console.log(null, a, b, c, Infinity, NaN, undefined);
// uglified code
// (beautified)
var _calls_ = 10, a = 100, b = 10, c = 0;

function f0(b_1_2, b_1) {
    var brake1 = 5;
    L28635: do {
        if (--b, --b + (Number(0xdeadn << 16n | 0xbeefn) in {
            b_1: b_1,
            1.5: --b + {
                Infinity: -(b_1 = !1)
            }[c = 1 + (c = 1 + c), 24..toString(), typeof 0]
        })) {
            var brake5 = 5;
            if ((c += 1) + b-- && 0 < brake5) {
                continue L28635;
            }
        }
        c += 1;
        brake5 = function b_1_2(arguments_2, b_1_2_2 = b_1_2 * (-3 * 24..toString() == 1) === (b_1_2 && (b_1_2.undefined = "c")), a_1) {
            (function() {
                c = 1 + c, 38..toString(), b_1 = "object" !== this;
            })();
            --b, {
                ...b_1
            }, c = 1 + c, b_1_2 && (b_1_2.Infinity = 2 === [ , 0 ].length == this), 
            c = 1 + c, c += 1, 38..toString(), c = 1 + (c = 1 + c), (arguments_2 += 1 + (-4 < this)) && (arguments_2.done = -0 !== {}), 
            b_1_2_2 && (b_1_2_2[c = 1 + c, c += 1, !1 < ({} >> 25 && 0)] += NaN);
        }("b" in [], null);
    } while (brake5++ + (c += 1, 4 <= 24..toString() && !0 & (23..toString(), [])) && 0 < --brake1);
}

var b_1 = f0(!1, a && "function" == typeof a.next && 0 <= --_calls_ && a.next(a++ + b), {});

console.log(null, a, b, c, 1 / 0, NaN, void 0);
original result:
null 100 6 4 Infinity NaN undefined

uglified result:
null 100 -2 18 Infinity NaN undefined
// reduced test case (output will differ)

// (beautified)
function f0() {
    L28635: do {
        if (0 + {}) {
            for (var brake5 = 5; brake5; --brake5) {
                continue L28635;
            }
        } else {}
        var a = 0;
    } while (a);
}

f0();
// output: 
// minify: Error: Script execution timed out after 100ms
// options: {
//   "mangle": false,
//   "module": false,
//   "output": {
//     "v8": true
//   },
//   "validate": true
// }
minify(options):
{
  "mangle": false,
  "module": false,
  "output": {
    "v8": true
  }
}

Suspicious compress options:
  dead_code
  loops
  merge_vars
  unused
@alexlamsl alexlamsl added the bug label Jan 4, 2023
alexlamsl added a commit to alexlamsl/UglifyJS that referenced this issue Jan 4, 2023
alexlamsl added a commit that referenced this issue Jan 4, 2023
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