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

Closed
alexlamsl opened this issue May 14, 2019 · 0 comments · Fixed by #3412
Closed

ufuzz failure #3411

alexlamsl opened this issue May 14, 2019 · 0 comments · Fixed by #3412
Labels

Comments

@alexlamsl
Copy link
Collaborator

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

function f0(a_2, foo_1, foo_1_2) {
    {
        var parseInt_2 = function f1(Infinity_1, a_1, undefined) {
            {
                var b = {
                    length: a++ + void ((foo_1 += -2 ^ 4 ^ "" + "undefined") - !-2 % ("foo" << "undefined")),
                    var: !function() {
                    }(),
                    b: (c = c + 1) + (typeof f1 == "function" && --_calls_ >= 0 && f1((c = 1 + c, (/[a2][^e]+$/ == 24..toString()) <= (a_1 && (a_1[(c = 1 + c, 
                    (c = c + 1, Infinity << 22) >>> ("foo" / 23..toString() << (Infinity_1 && (Infinity_1[(c = 1 + c, 
                    ("bar" % [] ^ 24..toString() !== [ , 0 ][1]) >= ((Infinity ^ 3) & (foo_1_2 && (foo_1_2.undefined = 25 << "bar"))))] = -0 ^ 4))))] = "bar" !== 22)) >= ((a_2 && (a_2.foo = 38..toString() % /[a2][^e]+$/)) ^ (25 ^ 23..toString())))))
                };
                {
                    var brake4 = 5;
                    L161215: do {
                        c = c + 1;
                    } while (+b && --brake4 > 0);
                }
            }
            (c = c + 1) + (Infinity_1 && Infinity_1.Infinity);
        }(+function() {
            {
                var expr7 = [ --b + ((3 ^ [ , 0 ].length === 2) + (23..toString() < -4) | ({} | 38..toString() | "c" << "")), --b + /[a2][^e]+$/, (c = c + 1) + (b ^= a), ++b, (c = c + 1) + (typeof f2 == "function" && --_calls_ >= 0 && f2((c = 1 + c, 
                foo_1 && (foo_1.var = (foo_1 -= (parseInt_2 += "a" < "undefined") < (foo_1_2 && (foo_1_2.NaN >>>= -2 & 25))) >= (38..toString() <= "a") << ({} | -4))), (c = 1 + c, 
                foo_1_2 <<= (1 > "b" | /[a2][^e]+$/ >>> 0) >> (foo_1 |= (undefined ^ 0) >> "bar" + "a")), (c = 1 + c, 
                (parseInt_2 && (parseInt_2[(c = 1 + c, (5 < [] && (foo_1 = 24..toString() || true)) + ([] !== true) % (-3 == 1))] /= {} <= "c")) == (NaN & 23..toString()) === (("foo", 
                "a") && -2 !== "")))) ][a++ + b--];
                for (var key7 in expr7) {
                    {
                        var brake8 = 5;
                        L161216: while ((c = c + 1) + ++a && --brake8 > 0) {
                            c = 1 + c, foo_1_2 = "undefined" * -2 >> (2 == 2) ^ (foo_1_2 && (foo_1_2[("c" === "undefined" && [ , 0 ][1] >>> [ , 0 ][1]) <= (2 >= 23..toString()) >> (-3 ^ [ , 0 ].length === 2)] *= (parseInt_2 && (parseInt_2[(c = 1 + c, 
                            delete (undefined % "c" % ("c" < 22)))] = 24..toString() ^ 23..toString())) >= 4 * 3));
                            c = 1 + c, (c = c + 1, "undefined") ^ (foo_1 = -0 > 22) || foo_1 && (foo_1[[ (c = 1 + c, 
                            (true - 3 == "function" >> "c") - (c = c + 1, a_2 = [ , 0 ][1] << 4)), (c = 1 + c, 
                            (foo_1 && (foo_1[(c = 1 + c, (null % -3, "function" >>> "object") <= (false << {} === -"bar"))] = ({}, 
                            -1))) << (-2 ^ "bar") != (c = c + 1, "foo", NaN)) ]] += (null != this, "foo" / 3));
                            c = 1 + c, (4 === "number" == (a_2 = 4 | "function")) + (-1 >>> 2 >>> (4 == 38..toString()));
                        }
                    }
                }
            }
            try {
                {
                    return --b + {
                        undefined: (c = 1 + c, [ , 0 ][1] * "number" * (-4 | 25) - !("function" != -1))
                    }.in;
                }
            } catch (a_2) {
                {
                    var expr15 = foo_1_2 = (c = 1 + c, (-2 >= true) % (1 != [ , 0 ][1]) == (foo_1 && (foo_1.null = -2 + -1)) >= (false >= ([ , 0 ].length === 2)));
                    for (var key15 in expr15) {
                        c = 1 + c;
                        var undefined_2 = expr15[key15];
                        L161217: {
                        }
                    }
                }
                for (var brake17 = 5; ((c = 1 + c, (([ , 0 ][1] ^ [ , 0 ].length === 2) >= (25 === [])) % ((-0 ^ 23..toString()) + ("object" === -2))) || 3).toString()[(c = 1 + c, 
                (("number" || "undefined") && "foo" >= true) <= (foo_1 && (foo_1[(c = 1 + c, "number" << -2 >> (this ^ "function") != +(true >> "")) ? (c = 1 + c, 
                0 > "number" !== (a_2 = -5 >= 0) ^ 25 == 2 != "object" % {}) : (c = 1 + c, 4 !== 0 === (24..toString() && "c") && 1 % 23..toString() > (-3 < "function"))] = ("a" !== "object") * (3 << -0))))] && brake17 > 0; --brake17) {
                    var brake18 = 5;
                    while ((c = 1 + c, ((c = c + 1, 2) == (-4 && "foo")) + (c = c + 1, -3 < "number")) && --brake18 > 0) {
                        c = 1 + c, (foo_1 && (foo_1[(c = c + 1) + (b = a)] = 2 << 24..toString() == undefined / "a")) <= ("undefined" & []) % (38..toString() !== true);
                    }
                }
            }
        }());
    }
    var undefined = a_2;
}

var foo_1 = f0(null);

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

function f0(v, u, t) {
    var e = function n(f, o) {
        a++, u += -6, c += 1, 0 <= --_calls_ && n((c = 1 + c, !1 <= (o && (o[(c = 1 + c, 
        c += 1, 0 >>> (NaN << (f && (f[(c = 1 + c, (3 & (t && (t.undefined = 25))) <= 1)] = 4))))] = !0)) >= (14 ^ (v && (v.foo = NaN)))));
        for (var r = 5; c += 1, +m && 0 < --r; ) {}
        c += 1, f && f.Infinity;
    }(+function() {
        var n = [ 38 + --b, --b + /[a2][^e]+$/, (c += 1) + (b ^= a), ++b, (c += 1) + ("function" == typeof f2 && 0 <= --_calls_ && f2((c = 1 + c, 
        u && (u.var = (u -= (e += !0) < (t && (t.NaN >>>= 24))) >= !0 << -4)), (c = 1 + c, 
        t <<= 0 >> (u |= (0 ^ d) >> "bara")), (c = 1 + c, 0 == (e && (e[(c = 1 + c, NaN)] /= !0)) == 1))) ][a++ + b--];
        for (var f in n) {
            for (var o = 5; (c += 1) + ++a && 0 < --o; ) {
                c = 1 + c, t = 0 ^ (t && (t[!0] *= 12 <= (e && (e[(c = 1 + c, !0)] = 15)))), c = 1 + c, 
                c += 1, "undefined" ^ (u = !1) || u && (u[[ (c = 1 + c, !1 - (c += 1, v = 0)), (c = 1 + c, 
                (u && (u[(c = 1 + c, !0)] = -1)) << -2 != (c += 1, NaN)) ]] += NaN), c = 1 + c, 
                v = 4;
            }
        }
        try {
            return --b + {
                undefined: (c = 1 + c, NaN)
            }.in;
        } catch (n) {
            var r = (c = 1 + c, t = 0 == !1 <= (u && (u.null = -3)));
            for (var N in r) {
                c = 1 + c;
            }
            for (var i = 5; ("" + (c = 1 + c, 1))[(c = 1 + c, !1 <= (u && (u[(c = 1 + c, 0 >> ("function" ^ this) != 1 ? (c = 1 + c, 
            0 != (n = !1) ^ !0) : (c = 1 + c, !1))] = 3)))] && 0 < i; --i) {
                for (var l = 5; c = 1 + c, ("foo" == (c += 1, 2)) + (c += 1, !1) && 0 < --l; ) {
                    c = 1 + c, u && (u[(c += 1) + (b = a)] = 2 << "24" == d / "a");
                }
            }
        }
    }()), d = v;
}

var foo_1 = f0(null);

console.log(null, a, b, c, 1 / 0, NaN, void 0);
original result:
�[1mnull�[22m �[33m112�[39m �[33m107�[39m �[33m46�[39m �[33mInfinity�[39m �[33mNaN�[39m �[90mundefined�[39m

uglified result:
evalmachine.<anonymous>:2
var _calls_=10,a=100,b=10,c=0;function f0(v,u,t){var e=function n(f,o){a++,u+=-6,c+=1,0<=--_calls_&&n((c=1+c,!1<=(o&&(o[(c=1+c,c+=1,0>>>(NaN<<(f&&(f[(c=1+c,(3&(t&&(t.undefined=25)))<=1)]=4))))]=!0))>=(14^(v&&(v.foo=NaN)))));for(var r=5;c+=1,+m&&0<--r;);c+=1,f&&f.Infinity}(+function(){var n=[38+--b,--b+/[a2][^e]+$/,(c+=1)+(b^=a),++b,(c+=1)+("function"==typeof f2&&0<=--_calls_&&f2((c=1+c,u&&(u.var=(u-=(e+=!0)<(t&&(t.NaN>>>=24)))>=!0<<-4)),(c=1+c,t<<=0>>(u|=(0^d)>>"bara")),(c=1+c,0==(e&&(e[(c=1+c,NaN)]/=!0))==1)))][a+++b--];for(var f in n)for(var o=5;(c+=1)+ ++a&&0<--o;)c=1+c,t=0^(t&&(t[!0]*=12<=(e&&(e[(c=1+c,!0)]=15)))),c=1+c,c+=1,"undefined"^(u=!1)||u&&(u[[(c=1+c,!1-(c+=1,v=0)),(c=1+c,(u&&(u[(c=1+c,!0)]=-1))<<-2!=(c+=1,NaN))]]+=NaN),c=1+c,v=4;try{return--b+{undefined:(c=1+c,NaN)}.in}catch(n){var r=(c=1+c,t=0==!1<=(u&&(u.null=-3)));for(var N in r)c=1+c;for(var i=5;(""+(c=1+c,1))[(c=1+c,!1<=(u&&(u[(c=1+c,0>>("function"^this)!=1?(c=1+c,0!=(n=!1)^!0):(c=1+c,!1))]=3)))]&&0<i;--i)for(var 

ReferenceError: m is not defined
    at n (evalmachine.<anonymous>:2:243)

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 May 14, 2019
alexlamsl added a commit to alexlamsl/UglifyJS that referenced this issue May 14, 2019
alexlamsl added a commit that referenced this issue May 14, 2019
alexlamsl added a commit to alexlamsl/UglifyJS that referenced this issue Oct 10, 2019
alexlamsl added a commit that referenced this issue Oct 10, 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