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

Closed
alexlamsl opened this issue Mar 22, 2018 · 0 comments · Fixed by #3017
Closed

ufuzz failure #3016

alexlamsl opened this issue Mar 22, 2018 · 0 comments · Fixed by #3017
Labels

Comments

@alexlamsl
Copy link
Collaborator

https://travis-ci.org/alexlamsl/UglifyJS2/builds/356830127

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

--b;

{
    var brake2 = 5;
    do {
        {
            var Math_2 = function f0(foo_1) {
                {
                    {
                        return foo_1 && foo_1[/[abc4]/.test((foo_1 && foo_1[(c = c + 1) + new function() {
                            this.in -= "number" + "c";
                            this[(c = 1 + c, ([] < 3 && 22 < "number") !== (foo_1 && (foo_1.b >>= -5 > NaN)) > (c = c + 1, 
                            null))] = this << {};
                        }()] || b || 5).toString())];
                    }
                }
                try {
                    if ({
                        in: (/[abc4]/.test((((c = 1 + c, ("object" <= -1 | ({}, 5)) > ((foo_1 = "undefined" + 2) >= (38..toString() >= 4))) || a || 3).toString() || b || 5).toString()) || 7).toString()[a++ + delete a]
                    }[typeof foo_1 == "function" && --_calls_ >= 0 && foo_1(-4)]) {
                        return typeof foo_1 == "function" && --_calls_ >= 0 && foo_1();
                    } else {
                        (c = c + 1) + {
                            "\t": a++ + true,
                            foo: 25,
                            b: {
                                a: (c = 1 + c, "foo" == 0 !== (5, "function"), "object" >= 0 ^ "" <= [ , 0 ][1]),
                                foo: (c = 1 + c, (foo_1 |= -1 >> -5) | (/[a2][^e]+$/ || -5) && (c = c + 1, 1 <= -0))
                            }.a,
                            0: {
                                c: (c = 1 + c, foo_1 &= ({}, 2) > (25 == true) || (0 > -4) - (c = c + 1, "b")),
                                "": (c = 1 + c, ((-0 != this) <= ([ , 0 ].length === 2 != 2)) * ((-3 == /[a2][^e]+$/) - (null > /[a2][^e]+$/))),
                                0: (c = 1 + c, (c = c + 1, {} && this) ^ (0 ^ [ , 0 ].length === 2) + (NaN > "bar"))
                            }.a,
                            1.5: --b + (typeof f0 == "function" && --_calls_ >= 0 && f0())
                        };
                    }
                } catch (foo_1) {
                    L11317: for (var brake10 = 5; (c = c + 1) + (--b + (b + 1 - .1 - .1 - .1) ? typeof foo_1 == "function" && --_calls_ >= 0 && foo_1() : foo_1 && (foo_1.b = (("foo" || false) & 3 / -1, 
                    (foo_1 && (foo_1[(c = 1 + c, (3 - undefined & "b" << true) / (-5 / -3 * void ""))] = 22 < 1)) | -5 * /[a2][^e]+$/))) && brake10 > 0; --brake10) {}
                    {
                        var c_2 = a++ + +((23..toString() + 3 && -3 & 2) <= (undefined == null) >> "bar" - "bar");
                        {
                            var expr14 = {}.NaN;
                            for (var key14 in expr14) {
                                {
                                    var brake15 = 5;
                                    while (/[abc4]/.test(((c = 1 + c, (Infinity || "c") == (23..toString() !== ([ , 0 ].length === 2)) !== ("undefined" || [ , 0 ].length === 2) % (/[a2][^e]+$/ / "number")) || b || 5).toString()) && --brake15 > 0) {
                                    }
                                }
                            }
                        }
                        {
                            var expr17 = typeof f2 == "function" && --_calls_ >= 0 && f2("b");
                            for (var key17 in expr17) {
                                c = 1 + c;
                                var foo_1 = expr17[key17];
                            }
                        }
                        {
                            switch (c = 1 + c, ([ , 0 ].length === 2) >>> "a" < null >>> false === (25 | 0) <= (c = c + 1, 
                            [ , 0 ][1])) {
                              case c = 1 + c, 4 << "number" < (c = c + 1, undefined) ^ (/[a2][^e]+$/ && 4) - (24..toString() & 25):
                                ;
                                break;

                              case c = 1 + c, (foo_1 && (foo_1[-b] &= "function" << 4 == (foo_1 && (foo_1[(c = 1 + c, 
                                !((-3 ^ -1) - (null << 2)))] += "object" >> 24..toString())))) != (false | 38..toString() && (foo_1 && (foo_1[(c = 1 + c, 
                                +24..toString() % (Infinity | []) << (foo_1 && (foo_1.c = NaN >= ([ , 0 ].length === 2))) - 24..toString() * -5)] += [ , 0 ][1] + -1))):
                                ;
                                break;

                              case c = 1 + c, ([] & /[a2][^e]+$/ ^ {} & "a") != (null >= ([ , 0 ].length === 2)) << (0 < 0):
                                ;

                              case c = 1 + c, 38..toString() % "c" >>> "foo" - 3 >>> (c_2 && (c_2[b--] = false !== 0 ^ (c = c + 1, 
                                -0))):
                                ;
                                break;
                            }
                            {
                            }
                        }
                    }
                } finally {
                    try {
                        switch ((c = c + 1) + a--) {
                          case {
                                a: (c = c + 1) + (c_2 && c_2[(c = 1 + c, ("c" - 2 < (-1 ^ -0)) >>> (([ , 0 ][1] !== 23..toString()) << (-5 > -0)))]),
                                c: (c = c + 1) + (c = 1 + c, ("a" == "function" && ({}, "number")) + (-0 >>> ([ , 0 ].length === 2), 
                                38..toString() <= -3))
                            }[b--]:
                            switch (--b + +function foo_2() {
                            }()) {
                              case delete (4 || -4 || (c_2 = [] % "b") || undefined - [] | {} != "c"):
                                c = 1 + c, (5 * true !== NaN >>> []) + (-0 >= null, 3 >>> "c");
                                c = 1 + c, c_2 && (c_2.a = ((-2 !== true) >>> "undefined" - []) - (([] | "c") + ("" == 4)));
                                break;

                              case c_2 && c_2.NaN:
                                c = 1 + c, void (3 | "number") == [ , 0 ][1] > /[a2][^e]+$/ > (1 == /[a2][^e]+$/);
                                break;

                              default:
                                c = 1 + c, foo_1 && (foo_1[[ (c = 1 + c, (22 >= -0 & this != -0) / ((c_2 *= "undefined" === []) | "object" + "b")), (c = 1 + c, 
                                (c = c + 1, [ , 0 ].length === 2) !== (c = c + 1, -3) | 25 === [ , 0 ][1] != ([ , 0 ].length === 2 && "a")), ,  ]] = undefined < -3 > ("object", 
                                "") >= ((c = c + 1, null) & (Infinity, null)));

                              case typeof undefined_1 === "number":
                                c = 1 + c, c = c + 1, (22 <= 2) / (foo_1 = this - "function");
                                break;
                            }
                            if (a--) {
                                for (var brake31 = 5; (c = 1 + c, ("a" << 4 >> ("b", -0)) - ("undefined" << true >>> (-2 > 2))) && brake31 > 0; --brake31) {
                                    c = 1 + c, (-5 > "number" && "foo" > []) << ((c_2 && (c_2[(c = 1 + c, (!Infinity == "c" >= -5) >> (([], 
                                    22) > ("foo" || -5)))] += NaN ^ 5)) ^ 2 != "foo");
                                }
                            } else {
                                break;
                            }
                            break;

                          case a++ + {
                                in: a++ + (b = a),
                                "\t": --b + !b,
                                set length(foo_1_2) {
                                    c = 1 + c, ("foo" >= 22 <= (-5 | true)) % ((22 > -1) >>> "number" + -2);
                                    this.b = -0 + "foo" <= (-4 || "object");
                                },
                                a: a++ + -(("object" >= -2) << (3 <= 3) >= 0 - ([ , 0 ].length === 2) >> (foo_1 = undefined < 25))
                            }.NaN:
                            break;

                          case (c = c + 1) + (1 === 1 ? a : b):
                            {
                                var brake35 = 5;
                                do {
                                    {
                                        var brake36 = 5;
                                        while ((c = 1 + c, (foo_1 && (foo_1[b++] = ([ , 0 ].length === 2 == "undefined") % (1 ^ /[a2][^e]+$/))) / ((25 ^ "bar") % (null - 22))) && --brake36 > 0) {
                                            c = 1 + c, ((foo_1 && (foo_1[(c = 1 + c, +("object" ^ 2) == (/[a2][^e]+$/ >= "c") % ("function" && {}))] = 24..toString() > "b")) <= -3 << {}) * (c = c + 1, 
                                            "b" & "bar");
                                        }
                                    }
                                } while (--b + delete (((this || 23..toString()) <= -3 >> ([ , 0 ].length === 2)) << (c_2 += undefined <= "" != ([] != "c"))) && --brake35 > 0);
                            }
                            break;

                          case ~void ("undefined" < -2 !== -0 >= "object"):
                            break;
                        }
                    } finally {
                        a++ + {
                            null: (c = 1 + c, c_2 && (c_2[a++ + (typeof foo_1 == "function" && --_calls_ >= 0 && foo_1())] += ("c" | Infinity) % (22 / "object") == "c" >= "number" > (38..toString() & -4))),
                            "\t": (c = 1 + c, (5 | -2) < "object" * "c" <= (foo_1 && (foo_1[a++ + "number"] &= -4 % "object" < ("bar" || undefined)))),
                            "-2": (c = 1 + c, c = c + 1, this - -1 >> "a" * [ , 0 ][1]),
                            "-2": (c = 1 + c, 5 + {} >= (c = c + 1, -4), (foo_1 && (foo_1.Infinity *= -3 ^ 25)) / ("number" >= this)),
                            a: (c = 1 + c, (undefined % "undefined" >>> (-4 === 0)) % (23..toString() == 4 !== "function" >>> "number"))
                        }.NaN;
                        {
                            var brake39 = 5;
                            do {
                                if (c = 1 + c, (foo_1 && (foo_1.a = 0 / []), c = c + 1, "b") < ((foo_1 && (foo_1.c >>>= "c" != 5)) != (22 && undefined))) {
                                    switch (c = 1 + c, (3 < ([ , 0 ].length === 2)) % (-5 == "c") ^ (-1 !== "a" ^ 3 !== [ , 0 ][1])) {
                                      case c = 1 + c, "foo" <= "a" & (foo_1 && (foo_1[(c = 1 + c, foo_1 && (foo_1.var = delete ("object" * false) != (("a" ^ -3) == (foo_1 && (foo_1[(c = 1 + c, 
                                        "number" % ([ , 0 ].length === 2) * (null && -3) < ("object" << 1 == ([ , 0 ].length === 2 ^ "")))] += 22 != "bar")))))] = "bar" || [ , 0 ].length === 2)) ^ (24..toString() | "undefined") >>> ("b" == 1):
                                        ;
                                        break;

                                      case c = 1 + c, ((-3 || 3) != "function" % true) >> (22 !== this | 23..toString() >>> "b"):
                                        ;
                                        break;

                                      case c = 1 + c, (true / true < ("object" != {})) % (foo_1 += ([ , 0 ].length === 2 ^ "b") - (-4 ^ 3)):
                                        ;
                                        break;

                                      case c = 1 + c, null * undefined % -undefined / (-0 + "foo" >>> ("function" << "a")):
                                        ;
                                        break;
                                    }
                                } else {
                                    return c = 1 + c, (-1 != 25) >= ([ , 0 ].length === 2 ^ -3) != ((38..toString() | 4) == (c_2 && (c_2[(c = 1 + c, 
                                    !(c_2 = 0 >> this & ([ , 0 ].length === 2 ^ NaN)))] = 22 + -3)));
                                }
                            } while (a++ + +function c_2() {}() && --brake39 > 0);
                        }
                    }
                    c = c + 1;
                }
            }("a", []);
        }
    } while ((c = c + 1) + {} && --brake2 > 0);
}

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

--n;

var t, l = 5;

do {
    t = "a", void 0 && t[/[abc4]/.test((t && t[(o += 1) + new function() {
        this.in -= "numberc", this[(o = 1 + o, ([] < 3 && !1) != (t && (t.b >>= !1)) > (o += 1, 
        null))] = this << {};
    }()] || n || 5).toString())];
} while ((o += 1) + {} && 0 < --l);

console.log(null, i, n, o, 1 / 0, NaN, void 0);
original result:
null 100 9 20 Infinity NaN undefined

uglified result:
null 100 9 5 Infinity NaN undefined

minify(options):
{
  "toplevel": true
}

Suspicious compress options:
  collapse_vars
  dead_code
  inline
  unused
alexlamsl added a commit to alexlamsl/UglifyJS that referenced this issue Mar 22, 2018
@alexlamsl alexlamsl added the bug label Mar 22, 2018
alexlamsl added a commit to alexlamsl/UglifyJS that referenced this issue Mar 22, 2018
alexlamsl added a commit to alexlamsl/UglifyJS that referenced this issue Mar 22, 2018
alexlamsl added a commit that referenced this issue Mar 22, 2018
alexlamsl added a commit to alexlamsl/UglifyJS that referenced this issue Mar 22, 2018
kzc referenced this issue in terser/terser May 4, 2018
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