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

Closed
alexlamsl opened this issue Aug 21, 2024 · 0 comments · Fixed by #5926
Closed

ufuzz failure #5924

alexlamsl opened this issue Aug 21, 2024 · 0 comments · Fixed by #5926
Labels

Comments

@alexlamsl
Copy link
Collaborator

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

function f0() {
    {
        var foo_1 = function f1(arguments_1, b_2, a_1) {
            function f2() {
                if ((c = c + 1) + ((c = 1 + c, (undefined || 3) <= ("b" ^ NaN) >= ("b" >> 2 | "c" <= 2)) || a || 3).toString()) {
                } else {
                    var a;
                }
                try {
                    c = 1 + c, (c = c + 1, false && /[a2][^e]+$/) != ("" >>> 24..toString()) - 5 ** -4;
                } catch (bar_1) {
                    c = 1 + c, (("object", -3) >> ([ , 0 ][1] & true)) / (b_2 && (b_2[[ (c = 1 + c, 
                    (Infinity ^ -5 ^ ("function" ^ NaN)) * (Infinity >> ([ , 0 ].length === 2)) ** ("object" * -0)) ].null] += (c = c + 1, 
                    []) >>> ({} || "foo")));
                    c = 1 + c, (a_1 && (a_1.a = -3 && 0 && "function" | "bar")) ^ (c = c + 1, 
                    1 && "undefined");
                    c = 1 + c, (arguments_1 && (arguments_1.var = "a" || false || "function" >> 3)) == ((a_1 && (a_1[c = 1 + c, 
                    ([ , 0 ][1] % 4 || a && (a.set = null * "object")) ^ ([] * [] | "function" >>> "object")] = "" * 1)) ^ 3 * -1);
                }
                return (c = c + 1) + (typeof f3 == "function" && --_calls_ >= 0 && f3(-3));
            }
            var b_1 = f2((c = c + 1) + (a++ + !((null - NaN, arguments_1 && ([ arguments_1[c = 1 + c, 
            arguments_1 && (arguments_1[a++ + void (c = c + 1, -(0 / -3))] += (b_2 && (b_2[(c = c + 1) + (0 === 1 ? a : b)] = undefined ^ /[a2][^e]+$/ | 3 ^ [ , 0 ].length === 2), 
            ([ , 0 ][1], -0) >= (5 === 1)))] ] = [ 24..toString() % 0 ])) ^ (a_1 += ("c" >>> [ , 0 ][1], 
            "number" > "object"))) || 8).toString()[((3 & "number") != (22 === -1)) > (c = c + 1, 
            b_2 = 25 === /[a2][^e]+$/)], 0);
            function f3(foo) {
                {
                    return b + 1 - .1 - .1 - .1;
                }
                try {
                    try {
                        c = 1 + c, "object" <= "undefined" != (4 ?? "foo") | false ^ /[a2][^e]+$/ ^ (24..toString(), 
                        "bar");
                    } catch (b_2) {
                    } finally {
                    }
                } catch (Infinity) {
                    c = 1 + c, (null + Infinity || NaN <= -5) ^ ("a" || 24..toString()) << ("a" || -1);
                    c = 1 + c, false % Infinity * (null == 2) + ("a" - -5 << (23..toString() <= 4));
                } finally {
                    c = 1 + c, (c = c + 1, null === false) ^ (2, "foo") & NaN >>> "";
                }
                {
                    return (c = c + 1) + (b = a);
                }
            }
            var a = f3(25, true);
            function f4(b_1, a_1) {
                switch (--b + (a && a.Infinity)) {
                  default:
                    c = 1 + c, (a_1 && (a_1[c = 1 + c, "c" >= "number" === (b_1 = Infinity > 1) === ((-0) ** 5 !== ("a" == -5))] = -5 >>> "function")) / (undefined & {}) === ((arguments_1 && (arguments_1[c = 1 + c, 
                    c = c + 1, "c" < 24..toString() != (b_1 <<= null ^ 3)] ??= 5 != 1)) == false > 38..toString());
                    c = 1 + c, ((-0 == -1) > "object" << 24..toString()) - ((2 > true) >> (true && -4));

                  case typeof await:
                    c = 1 + c, 24..toString() + [] <= "" << -0 ^ !("c" === -2);
                    c = 1 + c, (b_1 <<= ("c" & null) >> (-1 >= -4)) === (delete -3 ^ "number" > "bar");
                    c = 1 + c, (-0 >> -2 > "bar" << Number(0xdeadn << 16n | 0xbeefn)) * (("function" != -2) * (!0o644n != {}));
                    break;

                  case 24..toString() in [ (c = 1 + c, (-3 || "function") >= ("number" !== ([ , 0 ].length === 2)) | (-3 ^ 1 ?? 22 >>> 22)), (c = 1 + c, 
                    (0 ^ false) >>> (false < Infinity) < (a && ({
                        "-2": a[c = 1 + c, void (true >>> /[a2][^e]+$/) - ((c = c + 1, 
                        3) !== (c = c + 1, 4))]
                    } = {
                        "-2": 2 < NaN
                    }) || (-4 || "a"))), (c = 1 + c, (a_1 = "bar" !== 0 | -1 >>> true) - ((b_1 && (b_1[c = 1 + c, 
                    ("c" << "undefined") + NaN * "object" <= ("object" <= null ^ 5 === null)] **= false >>> undefined)) == (-0 === "foo"))) ]:
                    c = 1 + c, b_2 && (b_2.next += (a_1 && (a_1.then = -3 % -4)) ^ undefined >> "function") && "a" > true !== {} - true;

                  case b = a:
                    c = 1 + c, c = c + 1, "function" <= 25, b_2 += true < undefined == 24..toString() << undefined;
                    break;
                }
                L21265: for (var brake27 = 5; delete ((-3 >> "bar" || 38..toString() && "object") && ([ , 0 ].length === 2 | 23..toString()) ^ (5 && -0)) && brake27 > 0; --brake27) {
                }
                a++ + (b = a);
            }
            var a = f4();
        }(--b + (c = c + 1, [] != "number" | 5 ** 4), typeof /[abc4]/g.exec(((c = c + 1) + (a && typeof a.Infinity == "function" && --_calls_ >= 0 && a.Infinity()) || b || 5).toString()));
    }
}

var b_2 = f0(delete ((24..toString() || "bar") > "undefined" % ([ , 0 ].length === 2) != ("" >= Infinity) >> ("function" <= 1)), [ , 0 ][1], NaN);

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

(function() {
    var n, t, i, e, o;
    n = --c + (y += 1, "number" != [] | 625), t = typeof /[abc4]/g.exec(((y += 1) + ("function" == typeof N.Infinity && 0 <= --g && N.Infinity()) || c || 5).toString()), 
    y += 1, (e++ + (NaN, !((n && ([ n[y = 1 + y, n && (n[e++ + void (y += 1)] += (t && (t[(y += 1) + c] = undefined ^ /[a2][^e]+$/ | 3 ^ 2 === [ , 0 ].length), 
    !0))] ] = [ 24..toString() % 0 ])) ^ (i += !1))) || 8).toString()[(y += 1, t = !1) < !1], 
    y = 1 + (y += 1), (0 <= ((undefined || 3) <= ("b" ^ NaN)) || 3).toString();
    try {
        y = 1 + y, y += 1, 24..toString();
    } catch (u) {
        y = 1 + y, t && (t[[ (y = 1 + y, (-5 ^ Infinity ^ "function" ^ NaN) * (Infinity >> (2 === [ , 0 ].length)) ** NaN) ]["null"]] += (y += 1, 
        [] >>> {})), y = 1 + y, i && (i.a = 0), y = 1 + (y += 1), n && (n["var"] = "a"), 
        i && (i[y = 1 + y, o ^ ([] * [] | 0)] = 0);
    }
    y += 1, 0 <= --g && d();
    var f = void 0, a = void 0;
    switch (--c + ((e = d()) && e.Infinity)) {
      default:
        y = 1 + y, a && (a[y = 1 + y, !1 == (f = 1 < Infinity) == !0] = 4294967291), 
        undefined, n && (n[y = 1 + y, y += 1, "c" < 24..toString() != (f <<= 3)] ??= !0), 
        38..toString(), y = 1 + y, 24..toString();

      case typeof await:
        y = 1 + y, 24..toString(), f <<= 0, y = 1 + (y = 1 + y), Number(0xdeadn << 16n | 0xbeefn);
        break;

      case 24..toString() in [ (y = 1 + y, ("number" !== (2 === [ , 0 ].length)) <= -3 | -4), (y = 1 + y, 
        0 >>> (!1 < Infinity) < (e ? ({
            "-2": e[y = 1 + y, void 0 - (y += 1, 3 != (y += 1, 4))]
        } = {
            "-2": 2 < NaN
        }) : -4)), (y = 1 + y, (a = 2147483647) - (0 == (f && (f[y = 1 + y, 0 + "object" * NaN <= 0] **= !1 >>> undefined)))) ]:
        y = 1 + y, t && (t.next += (a && (a.then = -3)) ^ undefined >> "function");

      case c = e:
        y = 1 + y, y += 1, t += !0 < undefined == 24..toString() << undefined;
    }
    for (var r = 5; 23..toString(), 0 < r; --r) {}
    function d() {
        return c + 1 - .1 - .1 - .1;
    }
    c = ++e;
})((24..toString(), Infinity, NaN));

console.log(null, N, c, y, Infinity, NaN, undefined);
original result:
null 100 10.700000000000001 26 Infinity NaN undefined

uglified result:
null 100 9.700000000000001 26 Infinity NaN undefined
// reduced test case (output will differ)

// (beautified)
var b = 0;

function f2() {
    return f3;
}

function f3() {
    return b - .1;
}

var a = f3();

--b;

console.log(a);
// output: -0.1
// 
// minify: -1.1
// 
// options: {
//   "ie": true,
//   "module": false,
//   "output": {
//     "semicolons": false,
//     "v8": true
//   },
//   "toplevel": true,
//   "validate": true
// }
minify(options):
{
  "ie": true,
  "module": false,
  "output": {
    "semicolons": false,
    "v8": true
  },
  "toplevel": true
}

Suspicious compress options:
  collapse_vars
  dead_code
  inline
  reduce_vars
  sequences
  unused

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