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

Closed
alexlamsl opened this issue Oct 29, 2019 · 0 comments · Fixed by #3548
Closed

ufuzz failure #3547

alexlamsl opened this issue Oct 29, 2019 · 0 comments · Fixed by #3548
Labels

Comments

@alexlamsl
Copy link
Collaborator

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

try {
    switch (a++ + (typeof a == "function" && --_calls_ >= 0 && a(38..toString()))) {
      case function() {
            switch (a++ + (b |= a)) {
              case typeof f1 == "function" && --_calls_ >= 0 && f1(38..toString(), "bar"):
                [ a++ + {
                    NaN: (c = 1 + c, -2 / [ , 0 ][1] == "bar" % "function" != ((4 && -5) !== ("undefined" || -4))),
                    foo: (c = 1 + c, (undefined ^ 25) + (-4 > -3) > (0 === "c" | true >> "function")),
                    get c() {
                        c = 1 + c, ((a <<= 38..toString() >= "undefined") << ([ , 0 ][1] & 23..toString())) * (([ , 0 ][1],
                        5) == undefined >= /[a2][^e]+$/);
                    }
                }[(c = 1 + c, (4 && "undefined") >= ~NaN < (c = c + 1, -0 % "object"))], a && (a[(c = c + 1) + (a && a.c)] = (4 ^ Infinity) < (1 ^ 4) ^ false >= -3 !== "number" >> -3) ].var;
                L31484: {
                    {
                        var bar = function f0(a, parseInt) {
                        }(23..toString(), /[a2][^e]+$/);
                    }
                    {
                        var a_1 = function parseInt_1() {
                        }((c = 1 + c, ((24..toString() & 0) > 4 / 25) / ("a" % 3 / ("" & 3))));
                    }
                }
                break;

              default:
              case a_1:
                try {
                    c = c + 1;
                } catch (foo) {
                    if (a++ + +function() {
                    }()) {
                        var brake12 = 5;
                        while ((c = 1 + c, (-5 != {} ^ -0 - 38..toString()) - (25 & -4) / (/[a2][^e]+$/ ^ 3)) && --brake12 > 0) {
                            c = 1 + c, (Infinity - /[a2][^e]+$/ && "b" >= "function") <= ((a_1 && (a_1.foo = 25 != -2)) != ("undefined" & "undefined"));
                        }
                    }
                    var a_1 = (c = c + 1) + !function Infinity() {
                    }();
                } finally {
                    {
                        var expr15 = a++ + (typeof f1 == "function" && --_calls_ >= 0 && f1());
                        for (var key15 in expr15) {
                            {
                                return;
                                c = 1 + c, a_1 = (a_1 += (null ^ "c") > ("a" < "a")) >>> (NaN << Infinity && 23..toString() > /[a2][^e]+$/);
                            }
                        }
                    }
                    typeof a_1 == "function" && --_calls_ >= 0 && a_1(-0, (c = 1 + c, (-5 % null && null === -5) >>> (a_1 && (a_1.var >>= "function" <= 23..toString() && (a_1 && (a_1.b = -3 / {}))))), (c = 1 + c,
                    ("c" > [ , 0 ][1] & -0 > -0) == /[a2][^e]+$/ / "foo" >= (2 && [ , 0 ].length === 2)));
                }
                try {
                    for (var brake19 = 5; a_1 && brake19 > 0; --brake19) {
                        var brake20 = 5;
                        L31485: while ((b = a) && --brake20 > 0) {
                            L31486: for (var brake21 = 5; (c = 1 + c, 24..toString() !== "c" & NaN % "undefined" && (a_1 += null === undefined || 2 + 1)) && brake21 > 0; --brake21) {
                                c = 1 + c, (25 & [ , 0 ][1]) < 1 * "object" != (c = c + 1, "c" !== -2);
                            }
                        }
                    }
                } catch (a_1_1) {
                    {}
                    {}
                } finally {
                    for (var brake25 = 5; a++ + a_1 && brake25 > 0; --brake25) {
                        if (c = 1 + c, (false == 38..toString()) % (null <= "a") | (a_1 -= -0 == 0 == (-2 ^ "bar"))) {
                            c = 1 + c, "bar" <= -4 <= "" >>> "undefined" === (a_1 && (a_1.in ^= "a" >> -2 === null << -3));
                        } else {
                            c = 1 + c, c = c + 1, (-2, "number") >= (Infinity <= "b");
                        }
                    }
                    {
                        c = 1 + c, ((this ^ "foo") << 0 * null) * (a_1 /= "a" * {} >> (NaN ^ undefined));
                        c = 1 + c, ((a_1[(c = 1 + c, c = c + 1, ([] !== 22) >>> (38..toString() <= /[a2][^e]+$/))] *= 23..toString() || 23..toString()) && 4 * -2) & (Infinity || null) !== (NaN && "object");
                        c = 1 + c, (true && 1 && "" - 2) > (this | {}) >>> (/[a2][^e]+$/ <= 2);
                    }
                }
                break;

              case a++ + 3:
                {}
                break;
            }
        }():
        {
            var b_1 = function f1(Math, foo_1) {
                function f2(undefined, foo, c_1) {
                    L31487: for (var brake35 = 5; {
                        0: (c = 1 + c, ((-0 && 23..toString()) ^ ("undefined", false)) << (c_1 && (c_1[(c = 1 + c,
                        (c = c + 1, "c") > 25 % 38..toString() & (Infinity > null && "object" >= "object"))] = 5 >>> undefined < (foo_1 && (foo_1.a += 23..toString() % 22))))),
                        foo: (c = 1 + c, (c_1 && (c_1[a++ + null] = ("" ^ "b") != -0 % 0)) >= (-0 || "bar") >> (NaN || "number")),
                        set undefined(b_2) {
                            this.in |= [ , 0 ][1] || 4;
                        }
                    }[(c = 1 + c, (3 == "foo" !== 22 - "b") * ("foo" >= "object" !== true >> [ , 0 ][1]))] && brake35 > 0; --brake35) {
                    }
                    if ((c = 1 + c, ("number" & "c") != ("object" & "number") && (c = c + 1, -3 == "bar")) ? (c = 1 + c,
                    (-0 === 2) * (4 | true) + ([ , 0 ][1] - "number" <= (null >= Infinity))) : (c = 1 + c,
                    ((2, this) && {} === 1) & (23..toString() << {}) * ("c" ^ 5))) {
                        var brake38 = 5;
                        L31488: while ((c = 1 + c, ("c" ^ [ , 0 ].length === 2) != (22, "foo") || (-1 ^ "") < "bar" >> "c") && --brake38 > 0) {
                            c = 1 + c, "function" >> "" > {} >> 2, 2 == 0 || "foo" >>> "number";
                        }
                    } else {
                        var NaN_1 = (c = 1 + c, (c_1.in = (NaN | {}) !== "number" - true) & (false <= 1) << -5 % -1), b = (c = 1 + c,
                        (-1 ^ -0 ^ 25 < -5) / (undefined != "a" ^ (c_1 && (c_1[(c = 1 + c, (Infinity & this ^ "number" > -2) != ({} ^ -5) >>> "object" % -3)] = -2 ^ -2))));
                    }
                }
                var a = f2(false);
                function f3(foo_2) {
                    {
                        return;
                        [ (c = 1 + c, (-2, 22) <= (null ^ "function") || -5 % 5 > (0 | -0)), (c = 1 + c,
                        true / [ , 0 ][1] + 25 % ([ , 0 ].length === 2) <= (-4 <= 25 ^ !"b")), (c = 1 + c,
                        (foo_1 && (foo_1.undefined = [ , 0 ][1] >>> -3 | (true, 25))) >> ("function" & -4) + ("object" ^ -2)), ,  ][(c = 1 + c,
                        -(4 - "a" !== ("b" | 0)))];
                    }
                }
                var a_2 = f3();
                function f4(parseInt_2) {
                    {
                        var a = function f5(a, NaN_1, arguments_1) {
                        }("c", -1, 24..toString());
                    }
                    {
                        var brake44 = 5;
                        while (a++ + -a && --brake44 > 0) {
                            switch (c = 1 + c, -0 && 4 << ([ , 0 ].length === 2), ("a" && 5) - "number" / NaN) {
                              case c = 1 + c, delete (("c" == -2) << /[a2][^e]+$/ % "b"):
                                ;
                                break;

                              case c = 1 + c, ("undefined" >> -4) - "undefined" / 38..toString() & (this * "a" | (c = c + 1,
                                "bar")):
                                ;

                              case c = 1 + c, ((5 || "c") << (4 >> true)) + ((c = c + 1, -2) - (38..toString() == 1)):
                                ;
                                break;

                              case c = 1 + c, ~("object" == Infinity != (parseInt_2 = null * "a")):
                                ;
                                break;
                            }
                        }
                    }
                }
                var b_1 = f4(a++);
            }((c = c + 1) + b_1, -4, b--);
        }
        {
            var bar = function parseInt_2(a_1, Math_2) {
                var bar = a++ + (void void ([] >= "foo" <= void 4) ? /[abc4]/.test((a++ + function() {
                    c = 1 + c, (-4 ^ "number") === null > Infinity ^ NaN % -3 * (1 || "number");
                    c = 1 + c, !([] < "object" || this % [ , 0 ][1]);
                }() || b || 5).toString()) : --b + void function() {}()), bar = a++ + void (((c = c + 1,
                0) && -5 % 0) !== (1 + []) / (this > 4));
                try {
                    {
                        var c_2 = function bar_1(b_2) {
                            switch (c = 1 + c, (c = c + 1, "" ^ 22) != null % true >>> -2 * true) {
                              case c = 1 + c, (3 < "b") + (-0 >>> "undefined") >= ((2 || "") && 2 == 3):
                                ;
                                break;

                              default:
                                ;

                              case c = 1 + c, ("function" | 2) == (c = c + 1, true) === (0 === {} ^ 23..toString() == [ , 0 ][1]):
                                ;
                                break;

                              case c = 1 + c, (-0 >= 25 & (undefined & Infinity)) >= (c = c + 1, Infinity % undefined):
                                ;
                                break;
                            }
                        }("object");
                    }
                } finally {
                    if (typeof f5 == "function" && --_calls_ >= 0 && f5((c = 1 + c, a_1.null = 24..toString() - 3 + ("c" <= 4) === (-2 && "bar") >>> void "number"), (c = 1 + c,
                    (null << -0 & (Math_2 && (Math_2.Infinity = 5 & 5))) + (c = c + 1, true != "number")), (c = 1 + c,
                    (true >= [], c = c + 1, "object") * ((a_1 = 5 * "undefined") & (c = c + 1, 4))))) {
                        return (c = c + 1) + ~a;
                    }
                }
            }();
        }
        break;

      case a++ + b_1:
        {
            var brake57 = 5;
            do {
                a++ + (a++ + b--);
            } while ((1 === 1 ? a : b) && --brake57 > 0);
        }
        break;

      case (c = c + 1) + b--:
        break;

      case --b + (1 === 1 ? a : b):
    }
} catch (parseInt_1) {
    var parseInt_1;
    typeof parseInt_1 == "function" && --_calls_ >= 0 && parseInt_1(undefined, "number");
}

{
    var brake61 = 5;
    while ((c = c + 1) + (false === true == -3 >= -1) % (Infinity + 38..toString() - (undefined >>> 0)) && --brake61 > 0) {
        if (typeof b_1 == "function" && --_calls_ >= 0 && b_1(0, (c = c + 1) + delete void (b_1 = b_1 && (b_1.in = -4 === -3) || "a" - "object"))) {
            var foo_2 = function f6(a, a_2) {
                return (c = c + 1) + ++b;
                {
                    var expr65 = --b + !a;
                    for (var key65 in expr65) {
                        c = 1 + c;
                        var a_2_1 = expr65[key65];
                        try {
                            for (var brake67 = 5; (c = c + 1) + (typeof b === "object") && brake67 > 0; --brake67) {
                                var parseInt_1 = function a_2_1(b_1) {
                                    c = 1 + c, void (-4 << 0) >> (("function" != 2) < (b_1 = "object" ^ false));
                                    c = 1 + c, b_1 && (b_1.null = ((Infinity >= "") >>> (a_2_1 && (a_2_1[(c = 1 + c,
                                    (("a" | undefined) ^ "bar" > "bar") >= (("function" && [ , 0 ][1]) == -2 * NaN))] = -3 * 25)),
                                    1 != "a" ^ "undefined" << -3));
                                }(4, "object");
                            }
                        } finally {
                            var b_1_1;
                            {
                                {
                                    var brake73 = 5;
                                    L31489: do {
                                        c = 1 + c, (a_2_1 >>>= (5, "bar")) + ({} > 2) < ("a" > 2) + (c = c + 1, 24..toString());
                                    } while ((c = 1 + c, "bar" > false <= (-0 != "bar") || (Infinity <= []) % (/[a2][^e]+$/ <= 24..toString())) && --brake73 > 0);
                                }
                            }
                        }
                    }
                }
            }(b += a);
        } else {
            [ b_1 && b_1.undefined, (-0 >>> -1 || [ , 0 ][1] & -3) + ("function" <= "object" ^ (4 ^ 4)), typeof --a ].length;
        }
    }
}

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

try {
    switch (a++ + ("function" == typeof a && 0 <= --_calls_ && a("38"))) {
      case function() {
            switch (a++ + (b |= a)) {
              case "function" == typeof f1 && 0 <= --_calls_ && f1("38", "bar"):
                a++, {
                    NaN: (c = 1 + c, !0),
                    foo: (c = 1 + c, !0),
                    get c() {
                        c = 1 + c, a <<= !1;
                    }
                }[(c = 1 + c, !1 < (c += 1, NaN))], a && (a[(c += 1) + (a && a.c)] = 0);
                var r = void (c = 1 + c);
                break;

              default:
              case r:
                try {
                    c += 1;
                } catch (f) {
                    if (a++ + NaN) {
                        for (var e = 5; c = 1 + c, 0 < --e; ) {
                            c = 1 + c, r && (r.foo = !0);
                        }
                    }
                    r = (c += 1) + !0;
                } finally {
                    var f = a++ + ("function" == typeof f1 && 0 <= --_calls_ && f1());
                    for (var o in f) {
                        return;
                    }
                    "function" == typeof r && 0 <= --_calls_ && r(-0, (c = 1 + c, NaN >>> (r && (r.var >>= !1))), (c = 1 + c,
                    !0));
                }
                try {
                    for (var n = 5; r && 0 < n; --n) {
                        for (var t = 5; (b = a) && 0 < --t; ) {
                            c = 1 + c;
                        }
                    }
                } catch (c) {} finally {
                    for (var i = 5; a++ + r && 0 < i; --i) {
                        c = 1 + c, NaN | (r -= !1) ? (c = 1 + c, r && (r.in ^= !0)) : (c = 1 + c, c += 1);
                    }
                    (r /= 0)[(c = 1 + (c = 1 + (c = 1 + c)), c += 1, 1)] *= "23", c = 1 + c;
                }
                break;

              case 3 + a++:
            }
        }():
        var b_1 = (c += 1, b--, function() {
            for (var a = 5; {
                0: (c = 1 + c, 0),
                foo: (c = 1 + c, !1),
                set undefined(c) {
                    this.in |= 4;
                }
            }[(c = 1 + c, 1)] && 0 < a; --a) {}
            if (c = 1 + (c = 1 + c), 115 & (this && !1)) {
                for (var f = 5; c = 1 + c, 0 < --f; ) {
                    c = 1 + c;
                }
            } else {
                c = 1 + c, (void 0).in = !0, c = 1 + c;
            }
        }(), void function() {
            for (var a = void 0, f = 5; a++ - a && 0 < --f; ) {
                switch (c = 1 + c, NaN) {
                  case c = 1 + c, !0:
                    break;

                  case c = 1 + c, NaN & ("a" * this | (c += 1, "bar")):
                  case c = 1 + c, 20 + (c += 1, -2):
                  case c = 1 + c, -2:
                }
            }
        }()), bar = function(f) {
            a++, --b, a++, c += 1;
            try {
                !function() {
                    switch (c = 1 + c, 0 != (c += 1, 22)) {
                      case c = 1 + c, !0:
                        break;

                      default:
                      case c = 1 + c, 2 == (c += 1, !0) === 0:
                      case c = 1 + c, c += 1, !1:
                    }
                }();
            } finally {
                if ("function" == typeof f5 && 0 <= --_calls_ && f5((c = 1 + c, f.null = !1), (c = 1 + c,
                0 + (c += 1, !0)), (c = 1 + c, c += 1, "object" * ((f = NaN) & (c += 1, 4))))) {
                    return (c += 1) + ~a;
                }
            }
        }();
        break;

      case a++ + b_1:
        for (var brake57 = 5; a++, b--, ++a && 0 < --brake57; ) {}
        break;

      case (c += 1) + b--:
        break;

      case --b + a:
    }
} catch (parseInt_1) {
    var parseInt_1;
    "function" == typeof parseInt_1 && 0 <= --_calls_ && parseInt_1(void 0, "number");
}

for (var brake61 = 5; (c += 1) + 1 && 0 < --brake61; ) {
    if ("function" == typeof b_1 && 0 <= --_calls_ && b_1(0, (c += 1) + (b_1 = b_1 && (b_1.in = !1) || NaN,
    !0))) {
        var foo_2 = (b += a, (c += 1) + ++b);
    } else {
        b_1 && b_1.undefined, --a;
    }
}

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

uglified result:
null 102 108 12 Infinity NaN undefined

minify(options):
{
  "compress": {
    "keep_fargs": false,
    "passes": 1000000,
    "sequences": 1000000,
    "unsafe": true,
    "unsafe_Function": true,
    "unsafe_math": true,
    "unsafe_proto": true,
    "unsafe_regexp": true
  }
}
@alexlamsl alexlamsl added the bug label Oct 29, 2019
alexlamsl added a commit to alexlamsl/UglifyJS that referenced this issue Oct 29, 2019
alexlamsl added a commit that referenced this issue Oct 29, 2019
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