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

Closed
alexlamsl opened this issue Jan 1, 2020 · 0 comments · Fixed by #3665
Closed

ufuzz failure #3664

alexlamsl opened this issue Jan 1, 2020 · 0 comments · Fixed by #3665
Labels

Comments

@alexlamsl
Copy link
Collaborator

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

function f0() {
    function f1() {
        function f2(undefined_2, undefined_2_1, c) {
            function f3() {
            }
            var undefined_2_1 = f3((c = 1 + c, undefined_2_1 = (undefined_2_1 && (undefined_2_1.null = 5 % NaN <= "" / undefined)) / (-3 >= "foo" ^ -0 <= "undefined")));
            function f4(c) {
            }
            var b_1 = f4(false, "a");
            function f5() {
            }
            var a_2 = f5();
            function f6() {
            }
            var Math_2 = f6((c = 1 + c, (("function" && 25) | -4 ^ []) & (undefined_2 && (undefined_2.null = (c = c + 1, 
            24..toString()) >> -3 / false))), (c = 1 + c, ("b" === "c" === "undefined" >> -3) <= (/[a2][^e]+$/ >> false) % (2 << ([ , 0 ].length === 2))), "c");
        }
        var b_2 = f2(0 === 1 ? a : b, [ (c = 1 + c, b_2 && (b_2.a = (this << false < (23..toString() <= 2)) % (b_2 = ([] || "function") / (-1, 
        22)))), (c = 1 + c, b_2 && (b_2[~a] = ([ , 0 ].length === 2) < ([ , 0 ].length === 2) <= "number" % 5 >= ("c" << 1 !== "b" << 23..toString()))) ]);
        function f7(a_1) {
            {
                var brake1 = 5;
                do {
                    c = 1 + c, (0 << 25, NaN && 2) + (([ , 0 ][1] != "foo") > ("bar" !== NaN));
                } while ((c = 1 + c, (/[a2][^e]+$/ !== "a" && "b" ^ [ , 0 ].length === 2) & NaN * /[a2][^e]+$/ !== ([ , 0 ][1] | NaN)) && --brake1 > 0);
            }
            if (c = 1 + c, false > -2 > (4 > 22) ^ !(c = c + 1, 1)) {
                c = 1 + c, a_1 && (a_1.b += (a_1 = -5 % -0 << (24..toString() ^ "a")) * (delete ([ , 0 ].length === 2) | null + "foo"));
            } else {
                c = 1 + c, ("function" >>> "c" > ("a" >= "a")) + (("undefined", "c") <= (b_2 && (b_2[c = 1 + c, 
                [ , 0 ][1] >> "bar" >= (c = c + 1, 3) === ((c = c + 1, [ , 0 ].length === 2) !== {} - 0)] = 0 >>> 24..toString())));
            }
        }
        var b = f7();
    }
    var undefined_2 = f1("c", (c = c + 1) + (b += a));
    function f8(b_2, parseInt_2, Math) {
        {
            var brake7 = 5;
            L23959: while (new function() {}() && --brake7 > 0) {
                var brake8 = 5;
                while (b_2 && --brake8 > 0) {
                    undefined_2;
                }
            }
        }
    }
    var bar_1 = f8(23..toString());
    function f9(b_1, NaN_1) {
        try {
            {
                var expr12 = (c = c + 1) + (b + 1 - .1 - .1 - .1);
                for (var key12 in expr12) {
                    try {
                        switch (c = 1 + c, ((c = c + 1, -3) === /[a2][^e]+$/ + Infinity) > ((undefined_2 = "c" >>> 24..toString()) <= ("b", 
                        [ , 0 ].length === 2))) {
                          case c = 1 + c, ("number" ^ "b") / ([ , 0 ].length === 2 ^ -4) ^ ("" >= Infinity | (NaN_1 && (NaN_1[c = 1 + c, 
                            (NaN_1 && (NaN_1[(c = 1 + c, undefined_2 && (undefined_2.undefined >>= (-5 && -4 || (this || "b"), 
                            (-2 | 3) == (Infinity || -3)))) ? (c = 1 + c, ~((-3 || true) !== ([ , 0 ][1] != null))) : (c = 1 + c, 
                            delete (-5 % -4 <= (b_1 = "foo" || -3)))] = (22 && [ , 0 ][1]) >>> this / 5)) | 1 - 23..toString() > void 5] %= -0 / 3))):
                            ;
                            break;

                          case c = 1 + c, (1 - "foo" < ({} && NaN)) - (this ^ -2) / ("function" - "number"):
                            ;
                            break;

                          default:
                            ;

                          case c = 1 + c, Infinity <= 1 | (NaN | Infinity) || (c = c + 1, 23..toString()) > -5 - 22:
                            ;
                            break;
                        }
                    } catch (undefined_2_2) {
                        c = 1 + c, ([ , 0 ][1] !== this) >>> ("bar" << null) | (NaN, -4, {} >= 25);
                        c = 1 + c, +(NaN <= "undefined") << (b_1 += (-3 >>> "object") - (undefined_2 = true !== []));
                    }
                }
            }
        } finally {
            L23960: {
                c = 1 + c, (undefined >> [] ^ "c" & false) != "" / true - (this != "");
            }
            {
                var NaN_1_2 = function Infinity(arguments_1) {
                }((c = 1 + c, (undefined_2 && (undefined_2.Infinity = (38..toString() || "") ^ (1 ^ 23..toString()))) >>> (23..toString() - ([ , 0 ].length === 2) ^ (-5, 
                5))), "", (c = 1 + c, (bar_1 && (bar_1[void function Math() {
                }()] = (38..toString() || "bar") ^ "b" <= 22)) > (5 === [] !== ("object" == "c"))));
            }
        }
    }
    var a_2 = f9((c = c + 1) + -(-4 + 25 > -"number", bar_1 && (bar_1[(c = c + 1) + --b] = (0 != "object") >> (Infinity > 23..toString()))), typeof bar_1 == "function" && --_calls_ >= 0 && bar_1(22, [ (c = 1 + c, 
    (25 || true) / (undefined_2 && (undefined_2[c = 1 + c, bar_1 -= (undefined_2 && (undefined_2[c = 1 + c, 
    (1 - [], -0 <= []) !== (a_2 && (a_2.var = (true ^ "object") < ({} | [])))] <<= 22 - this)) >= (-5 <= false) || "foo" > 3 != ("foo" != "undefined")] ^= "a" % true)) != (bar_1 && (bar_1.foo = (bar_1 ^= 2 ^ false) >= ("" !== "object")))), (c = 1 + c, 
    (a_2 && (a_2.c = Infinity % "foo" && true % "foo")) + (-4 | undefined | false % {})), (c = 1 + c, 
    ((-4 ^ {}) <= (22 & 2)) % ((0 != -4) < (bar_1 = 2 + "foo"))), (c = 1 + c, ([ , 0 ][1] % "a" | ~"number") < ((38..toString() && "a") <= (-0 & undefined))) ][[ (c = 1 + c, 
    ({} < Infinity) >> (a_2 && (a_2[c = 1 + c, ((2 >> false) - (-1 === /[a2][^e]+$/)) / (-2 % 1 || ([ , 0 ].length === 2) * Infinity)] = /[a2][^e]+$/ / -0)) | (c = c + 1, 
    true ^ -1)), (c = 1 + c, (([ , 0 ].length === 2) < 24..toString() ^ -1 != "a") - (false <= 22 & [] >= -3)) ].null], !a), b--);
}

var bar = f0();

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

!function() {
    var i = function() {
        var n, a, o = (n = i, a = 1 + a, (r = 1 + r, o && (o.a = (this << !1 < !1) % (o = 0)), 
        r = 1 + r, o && (o[-101] = !0)).null = !1, a = 1 + a, n && (n.null = (a += 1, 24)), 
        void (a = 1 + a)), i = function(n) {
            for (var a = 5; r = 1 + (1 + r), 0 < --a; ) {}
            r = 1 + r, !0 ^ (r += 1, !1) ? (r = 1 + r, n && (n.b += n = 0)) : (r = 1 + r, o && (o[r = 1 + r, 
            r += 1, 0 == (NaN !== (r += 1, !0))] = 0));
        }();
    }((r += 1, t += 100)), f = function() {
        for (var n = 5; new function() {}() && 0 < --n; ) {
            for (var a = 5; 0 < --a; ) {}
        }
    }(), n = function(n) {
        try {
            var a = (r += 1) + (t + 1 - .1 - .1 - .1);
            for (var o in a) {
                try {
                    switch (r = 1 + r, (i = 0) <= !0 < !1) {
                      case r = 1 + (r += 1), -0 ^ (!1 | (n && (n[r = 1 + r, !1 | (n && (n[r = 1 + r, i && (i.undefined >>= !1) ? (r = 1 + r, 
                        -2) : (r = 1 + r, !0)] = 0 >>> this / 5))] %= -0))):
                      case r = 1 + r, !1 - (-2 ^ this) / NaN:
                        break;

                      default:
                      case r = 1 + r, r += 1, !0:
                    }
                } catch (n) {
                    r = 1 + (r = 1 + r), i = !0;
                }
            }
        } finally {
            r = 1 + (r = 1 + r), i && (i.Infinity = 48), r = 1 + r, f && (f[void 0] = 38);
        }
    }((r += 1, f && (f[(r += 1) + --t] = 0), "function" == typeof f && 0 <= --a && f(22, [ (r = 1 + r, 
    25 / (i && (i[r = 1 + r, f -= !0 <= (i && (i[r = 1 + r, !0 !== (n && (n.var = !1))] <<= 22 - this)) || !0] ^= NaN)) != (f && (f.foo = !0 <= (f ^= 2)))), (r = 1 + r, 
    (n && (n.c = NaN)) + -4), !0 % (!0 < (f = "2foo")), !0 ][[ (r = 1 + (1 + (1 + r)), 
    !1 >> (n && (n[r = 1 + r, 0] = NaN)) | -2), (r = 1 + (r + 1), -1) ].null], !1)), t--);
}(), console.log(null, 100, t, r, 1 / 0, NaN, void 0);
original result:
null 100 109 21 Infinity NaN undefined

uglified result:
evalmachine.<anonymous>:1
(function(){var a=10,t=10,r=0;!function(){var i=function(){var n,a,o=(n=i,a=1+a,(r=1+r,o&&(o.a=(this<<!1<!1)%(o=0)),r=1+r,o&&(o[-101]=!0)).null=!1,a=1+a,n&&(n.null=(a+=1,24)),void(a=1+a)),i=function(n){for(var a=5;r=1+(1+r),0<--a;);r=1+r,!0^(r+=1,!1)?(r=1+r,n&&(n.b+=n=0)):(r=1+r,o&&(o[r=1+r,r+=1,0==(NaN!==(r+=1,!0))]=0))}()}((r+=1,t+=100)),f=function(){for(var n=5;new function(){}&&0<--n;)for(var a=5;0<--a;);}(),n=function(n){try{var a=(r+=1)+(t+1-.1-.1-.1);for(var o in a)try{switch(r=1+r,(i=0)<=!0<!1){case r=1+(r+=1),-0^(!1|(n&&(n[r=1+r,!1|(n&&(n[r=1+r,i&&(i.undefined>>=!1)?(r=1+r,-2):(r=1+r,!0)]=0>>>this/5))]%=-0))):case r=1+r,!1-(-2^this)/NaN:break;default:case r=1+r,r+=1,!0:}}catch(n){r=1+(r=1+r),i=!0}}finally{r=1+(r=1+r),i&&(i.Infinity=48),r=1+r,f&&(f[void 0]=38)}}((r+=1,f&&(f[(r+=1)+--t]=0),"function"==typeof f&&0<=--a&&f(22,[(r=1+r,25/(i&&(i[r=1+r,f-=!0<=(i&&(i[r=1+r,!0!==(n&&(n.var=!1))]<<=22-this))||!0]^=NaN))!=(f&&(f.foo=!0<=(f^=2)))),(r=1+r,(n&&(n.c=NaN))+-4),!0%(!0<(f="

TypeError: Cannot set property 'null' of undefined
    at evalmachine.<anonymous>:1:144
    at evalmachine.<anonymous>:1:327
minify(options):
{
  "compress": {
    "passes": 1000000,
    "unsafe": true
  },
  "toplevel": true
}
@alexlamsl alexlamsl added the bug label Jan 1, 2020
alexlamsl added a commit to alexlamsl/UglifyJS that referenced this issue Jan 1, 2020
alexlamsl added a commit that referenced this issue Jan 1, 2020
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