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

Closed
alexlamsl opened this issue Jun 20, 2024 · 0 comments · Fixed by #5862
Closed

ufuzz failure #5861

alexlamsl opened this issue Jun 20, 2024 · 0 comments · Fixed by #5862
Labels

Comments

@alexlamsl
Copy link
Collaborator

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

function f0() {
    {
        var a_2 = function f1({
            static: await
        }) {
            function f2(arguments_1) {
                {
                    var Infinity = function* Infinity(NaN_1, foo_2) {
                    }(/[a2][^e]+$/);
                }
                {
                    var brake4 = 5;
                    while ((c = c + 1) + (typeof let_2 === "function") && --brake4 > 0) {
                        var Infinity;
                    }
                }
                var a_2, await, yield_2;
            }
            var await = f2`$${await && typeof await.set == "function" && --_calls_ >= 0 && await.set(4, (c = 1 + c, 
            -("function" * false) % ("b" ?? {}) ** +"bar"), "function")}\\`;
            function f3(a_2) {
                var foo = a++ + (1 === 1 ? a : b);
                switch (function() {
                }) {
                  default:
                    c = 1 + c, "foo" + -2 >> ([] == ([ , 0 ].length === 2)) !== false >>> "b" << (NaN < "b");
                    c = 1 + c, (foo += ("a" && 22) >>> [ , 0 ][1] + 1) - ([ , 0 ][1] + -3 >>> (4 != 5));
                    c = 1 + c, -(-4 % 2 - (c = c + 1, []));

                  case foo:
                    c = 1 + c, await && (await[(c = c + 1) + b--] = (await && (await.foo += (await && (await.then = -2 >>> [])) === (2 !== {}))) == (("" ^ 1) & 1 <= true));
                    c = 1 + c, ((5 | "c") >>> ("b" === "c")) + (("undefined" | "undefined") != (await = [ , 0 ][1] - -4));
                    c = 1 + c, ((22 ^ -4) & (await = 5 + -4)) * (-2 ^ {} ^ ("bar", 
                    "a"));
                    break;

                  case delete (c = c + 1, -3 * "b" != "foo" <= []):
                    c = 1 + c, (foo += (await = -2 & -3) && [ , 0 ][1] > this) && ~(23..toString() ^ -4);
                    break;

                  case false in [ ..."" + await ]:
                    break;
                }
            }
            var undefined = f3(-0, a++ + ((c = c + 1) + undefined || 1).toString()[--b + await?.[c = 1 + c, 
            (!0o644n - "undefined" >= [] << "foo") >>> ((undefined && ({
                b: undefined[c = 1 + c, ([ , 0 ][1], -4) <= ([ , 0 ][1] > "a") ?? 25 + 0 - (-4 && 3)]
            } = {
                b: 23..toString() && {}
            })) ^ "function" === -2)]], typeof undefined == "function" && --_calls_ >= 0 && undefined((c = 1 + c, 
            -(await && (await[b = a] %= (await && (await.c = 4 * [ , 0 ][1])) !== (0 ?? Infinity))))));
            function f4(a_2) {
                {
                    var brake16 = 5;
                    while (a_2 && a_2[c = 1 + c, (c = c + 1, -1 > "function") | (await && (await[(c = c + 1) + [ (c = 1 + c, 
                    (2 >> 2 ^ -2 !== 24..toString()) * ({} < this < (24..toString() <= "c"))), (c = 1 + c, 
                    (2 != 24..toString()) >> ("number" | 22) << (await && (await.then += "bar" == ([ , 0 ].length === 2) ^ 23..toString() >>> Infinity))) ]] = "bar" ^ -2 ^ -5 < 24..toString()))] && --brake16 > 0) {
                        if (c = 1 + c, +(await && ([ await[c = 1 + c, (-2 << NaN >= ("a" <= (-42n).toString())) % ({} / "" === ([ , 0 ].length === 2 & [ , 0 ].length === 2))] ] = [ "undefined" / "b" ])) !== "foo" * {} / (-1 ^ null)) {
                            c = 1 + c, ((c = c + 1, false) & [] >> "number") << ((c = c + 1, 
                            3) << (-0 !== -4));
                        } else {
                            c = 1 + c, ((25 == "bar") + (this === "undefined")) % (-3 - 38..toString() == -0 << "a");
                        }
                    }
                }
                if (a++ + {
                    "\t": (c = 1 + c, undefined += 23..toString() >>> -2 < "a" >>> NaN != (undefined * "" | [ , 0 ].length === 2 === 1)),
                    next: (c = 1 + c, (a_2 && ([ a_2.async ] = [ ([ , 0 ].length === 2) % 22 ]), 
                    "undefined" > "undefined") << (({} && undefined) ^ "function" * "foo"))
                }[c = 1 + c, 23..toString() % [] & "foo" >> "bar" | (a_2 = (0 >= undefined) << ("function" > -0))]) {
                    var brake21 = 5;
                    L24163: do {
                        c = 1 + c, !((4 && "undefined") >= (undefined & 38..toString()));
                    } while ((c = 1 + c, (22 + 5) % ("object" % ([ , 0 ].length === 2)) === ([ , 0 ].length === 2) <= "object" <= (-1 > "number")) && --brake21 > 0);
                }
            }
            var undefined_1 = f4(a++ + [ ..."" + await ], {});
        }({
            get: typeof f2 == "function" && --_calls_ >= 0 && f2(b--, Infinity),
            "\t": --b + ((c = c + 1) + void (((c = c + 1, 1) && (a = 0 === -2)) !== ({} ^ -1) % (c = c + 1, 
            -1)) || 8).toString()[typeof (a++ + {
                async: typeof a == "function" && --_calls_ >= 0 && a("c"),
                value: --b + /[abc4]/.test((a++ + {
                    3: (c = 1 + c, ("object" !== "foo" || -4 | []) * (("foo" | /[a2][^e]+$/) != [] < -3))
                } || b || 5).toString()),
                static: a++ + void function() {
                    c = 1 + c, delete (/[a2][^e]+$/ & "undefined" ^ NaN > 23..toString());
                }()
            })],
            static: 38..toString()
        }, ~b, 23..toString());
    }
}

var b_2 = f0(a++ + (((b_2 && (b_2[c = 1 + c, (c = c + 1, "c" ^ "undefined") !== (this | 3) / (b_2 && (b_2[c = 1 + c, 
2 / 24..toString() / (2 == this) - (~"undefined" === 1 > 22)] /= "number" % Infinity))] = "c" ^ 2)) > (5 !== true)) >> ("undefined" * "bar" < {} << "undefined")), -5);

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

function f0() {
    var e, f;
    "function" == typeof f2 && 0 <= --_calls_ && f2(b--, 1 / 0), --b, a = !1, c = (c += 1) + 1 + 1, 
    "function" == typeof ++a && 0 <= --_calls_ && a("c"), --b, (a++ + {
        3: (c = 1 + c, 0)
    } || b || 5).toString(), a++, c = 1 + c, e = function(a) {
        for (var t = 5; (c += 1) + ("function" == typeof let_2) && 0 < --t; ) {}
    }`$${e = "38", "function" == typeof e.set && 0 <= --_calls_ && e.set(4, (c = 1 + c, 
    NaN), "function")}\\`, f = function() {
        switch (function() {}) {
          default:
            c = 1 + (c = 1 + (c = 1 + c)), c += 1;

          case a++ + a:
            c = 1 + c, e && (e[(c += 1) + b--] = 1 == (e && (e.foo += !0 === (e && (e.then = -2 >>> []))))), 
            e = 4, c = 1 + (c = 1 + c), e = 1;
            break;

          case c += 1, !1 in [ ..."" + e ]:
        }
    }((a++, --b, c = 1 + (c += 1))), function(t) {
        for (var n = 5; t && t[c = 1 + c, c += 1, !1 | (e && (e[(c += 1) + [ +({} < this < !0), (c = 1 + (c = 1 + c), 
        0 << (e && (e.then += "bar" == (2 === [ , 0 ].length) ^ 23))) ]] = -1))] && 0 < --n; ) {
            c = 1 + c, c = NaN !== +(e && ([ e[c = 1 + c, ("a" <= "" + -42n <= -2) % (NaN === (2 === [ , 0 ].length & 2 === [ , 0 ].length))] ] = [ NaN ])) ? (c = 1 + c) + 1 + 1 : 1 + c;
        }
        if (a++ + {
            "\t": (c = 1 + c, f += 0 != ("" * f | 2 === [ , 0 ].length === 1)),
            next: (c = 1 + c, t && ([ t.async ] = [ (2 === [ , 0 ].length) % 22 ]), 
            !1 << (NaN ^ f))
        }[c = 1 + c, 0 | (t = (f <= 0) << !1)]) {
            for (var o = 5; c = 1 + (c = 1 + c), 27 % ("object" % (2 === [ , 0 ].length)) === (2 === [ , 0 ].length) <= "object" <= !1 && 0 < --o; ) {}
        }
    }(a++ + [ ..."" + e ]);
}

var b_2 = f0(a++ + ((!0 < (b_2 && (b_2[c = 1 + c, c += 1, 0 != (3 | this) / (b_2 && (b_2[c = 1 + c, 
2 / "24" / (2 == this) - !1] /= NaN))] = 2))) >> !1), -5);

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

uglified result:
null 7 7 28 Infinity NaN undefined
// reduced test case (output will differ)

// (beautified)
(function f1(await) {
    function f2() {}
    var await = f2`$${await.set}\\`;
    await?.[0()];
})({});
// output: 
// minify: TypeError: 0 is not a function
// options: {
//   "compress": {
//     "passes": 1000000,
//     "sequences": 1000000,
//     "unsafe": true,
//     "unsafe_Function": true,
//     "unsafe_math": true,
//     "unsafe_proto": true,
//     "unsafe_regexp": true
//   },
//   "module": false,
//   "output": {
//     "v8": true
//   },
//   "validate": true
// }
minify(options):
{
  "compress": {
    "passes": 1000000,
    "sequences": 1000000,
    "unsafe": true,
    "unsafe_Function": true,
    "unsafe_math": true,
    "unsafe_proto": true,
    "unsafe_regexp": true
  },
  "module": false,
  "output": {
    "v8": true
  }
}

Suspicious compress options:
  collapse_vars
  evaluate
  inline
  passes
  properties
  pure_getters
  reduce_vars
  sequences
  side_effects
  unsafe
  unused

Suspicious options:
  rename
@alexlamsl alexlamsl added the bug label Jun 20, 2024
alexlamsl added a commit to alexlamsl/UglifyJS that referenced this issue Jun 20, 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