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

Closed
alexlamsl opened this issue Jan 7, 2020 · 0 comments · Fixed by #3674
Closed

ufuzz failure #3673

alexlamsl opened this issue Jan 7, 2020 · 0 comments · Fixed by #3674
Labels

Comments

@alexlamsl
Copy link
Collaborator

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

function f0(a) {
    function f1(undefined, undefined, bar_2) {
        for (var brake1 = 5; --b + {
            Infinity: --b,
            in: [][c = 1 + c, ("object" << "a" >>> (c = c + 1, 25)) / ((bar_2 && (bar_2.in += "object" + NaN)) << ("object" < "number"))],
            undefined: {
                0: (c = 1 + c, (null % -2 ^ 25 - "function") <= (-3 & -3) % (undefined >>> -3)),
                "\t": (c = 1 + c, ({} > 23..toString() & -0 <= Infinity) - (("bar" | 3) << void /[a2][^e]+$/)),
                "\t": (c = 1 + c, (0 << 2 ^ "object" >= 22) % (undefined >>> 3 && (0, -4)))
            }.Infinity,
            3: (c = 1 + c, bar_2 && (bar_2[function a_1() {
                c = 1 + c, (24..toString() % 2 || -0 + 25) & ("" ^ /[a2][^e]+$/) % (-4 >> "function");
                c = 1 + c, ((1 | [ , 0 ].length === 2) == ([ , 0 ].length === 2) * "number") >= (23..toString() > 5, 
                a_1 && (a_1[c = 1 + c, (a_1 && (a_1.c += -4 >> ([ , 0 ].length === 2) & "undefined" === "b")) !== delete (NaN != 2)] = undefined != 3));
                c = 1 + c, (a_1 && (a_1[--b + +a] -= ("undefined" ^ true) >= (0 || -4))) << (c = c + 1, 
                3) - (25 >> "a");
            }] += ((bar_2 &= true > 3) == (-4 & "undefined")) % (bar_2 = ("function" & "number", 
            bar_2 && (bar_2.a >>>= "foo" ^ 0)))))
        } && brake1 > 0; --brake1) {
            L10214: {
                {
                    var brake7 = 5;
                    while ((c = 1 + c, (Infinity * 22 === true > -0) >= (c = c + 1, true > -2)) && --brake7 > 0) {
                        c = 1 + c, (24..toString() | 5) * ([] || "") % (undefined >> 23..toString() >> ("object" >> 24..toString()));
                    }
                }
                switch (c = 1 + c, (4 & 22) / (bar_2 && (bar_2.b = undefined + -0)) >> ("" & "c" & (bar_2 && (bar_2[c = 1 + c, 
                ((false & "undefined") >>> "a" + 2) - ((1 ^ -5) & this * 24..toString())] = null - -2)))) {
                  default:
                    ;

                  case c = 1 + c, -5 >> null > ([] != 23..toString()) < (-5 < NaN > (bar_2 && (bar_2.null <<= "function" != "number"))):
                    ;
                    break;

                  case c = 1 + c, Infinity * 23..toString() === NaN >>> -4 === (bar_2 %= (-5 != 1) << ([] == this)):
                    ;
                    break;

                  case c = 1 + c, (-4 <= 24..toString() && "c" ^ true) & NaN % this / (bar_2 /= 3 | "function"):
                    ;
                    break;
                }
                c = 1 + c, (bar_2 && (bar_2.c += (38..toString() ^ -5) > "b" >>> "undefined")) <= (c = c + 1, 
                -0 >> 25);
            }
        }
        if (~(("b" || 4) <= (24..toString() !== -3) && (bar_2 && (bar_2.var = undefined % "bar" ^ false >> ([ , 0 ].length === 2))))) {
            var expr12 = [ (c = 1 + c, "bar" !== this != (24..toString() ^ -2) ^ ~-1 !== (c = c + 1, 
            1)), (c = 1 + c, (-0 < true & -1 >>> {}) >= delete (undefined || 2)), (c = 1 + c, 
            (/[a2][^e]+$/ | [ , 0 ].length === 2) - (/[a2][^e]+$/ - 4) <= (c = c + 1, 4 ^ true)), (c = 1 + c, 
            (c = c + 1, "object" / 24..toString()) - (false % "undefined" >> (-0 >> -1))), (c = 1 + c, 
            a_2 += (({} | 3) == (24..toString() == -2)) * (("undefined" && [ , 0 ][1]) !== (undefined ^ -5))) ];
            for (var key12 in expr12) {
                c = 1 + c;
                var a_2 = expr12[key12];
            }
        } else {
            return a++ + /[abc4]/.test(([ , (c = 1 + c, 24..toString() > "function" >= -2 >>> 3 <= ("c" ^ 1) - (25 & "foo")), (c = 1 + c, 
            "number" >> "c" << -4 * ([ , 0 ].length === 2) != (([ , 0 ].length === 2) - null & (-2 & "c"))) ] || b || 5).toString());
        }
    }
    var c = f1(false, "", {
        3: --b + (a && a.in)
    }.a);
}

var b_2 = f0(typeof b--, b_2 = [ b_2 ], (c = c + 1) + (true <= "a" == (this ^ 3) != (b_2 && (b_2.c <<= (undefined, 
-5))) << "foo" / undefined));

console.log(null, a, b, c, Infinity, NaN, undefined);
// uglified code
// (beautified)
var o, e, s = 10;

o = typeof s--, [ f ].c <<= -5, e = function(n, n, i) {
    for (var a = 5; --s + {
        Infinity: --s,
        in: [][e = 1 + e, (0 >>> (e += 1, 25)) / ((i && (i.in += "objectNaN")) << !1)],
        undefined: {
            0: 0 <= -3 % (n >>> -3),
            "\t": 0 % (n >>> 3 && -4)
        }.Infinity,
        3: (e = 1 + (1 + (1 + (1 + e))), i && (i[function i() {
            i[e = 1 + (1 + (1 + e)), !0 !== (i.c += 0)] = 3 != n, e = 1 + e, i[--s + +o] -= !0, 
            e += 1;
        }] += (0 == (i &= !1)) % (i = i && (i.a >>>= 0))))
    } && 0 < a; --a) {
        switch (e = 1 + ((e = 1 + e) + 1), 4 / (i && (i.b = n + -0)) >> (0 & (i && (i[e = 1 + e, 
        0 - (-6 & "24" * this)] = 2)))) {
          default:
          case e = 1 + e, !1 < ((i && (i.null <<= !0)) < !1):
          case e = 1 + e, !1 === (i %= !0 << ([] == this)):
          case e = 1 + e, 1 & NaN % this / (i /= 3):
        }
        e = 1 + e, i && (i.c += !1), e += 1;
    }
    var t = [ "bar" !== this != -26 ^ !0, !0, !1, NaN, (e = 1 + ((e = 1 + ((e = 1 + (1 + ((e = 1 + e) + 1))) + 1)) + 1), 
    f += !1 * (0 != (-5 ^ n))) ];
    for (var c in t) {
        e = 1 + e;
        var f = t[c];
    }
}(!1, "", {
    3: --s + (o && o.in)
}.a), console.log(null, 100, s, 1, 1 / 0, NaN, void 0);
original result:
null 100 -4 1 Infinity NaN undefined

uglified result:
evalmachine.<anonymous>:1
(function(){var o,e,s=10;o=typeof s--,[f].c<<=-5,e=function(n,n,i){for(var a=5;--s+{Infinity:--s,in:[][e=1+e,(0>>>(e+=1,25))/((i&&(i.in+="objectNaN"))<<!1)],undefined:{0:0<=-3%(n>>>-3),"\t":0%(n>>>3&&-4)}.Infinity,3:(e=1+(1+(1+(1+e))),i&&(i[function i(){i[e=1+(1+(1+e)),!0!==(i.c+=0)]=3!=n,e=1+e,i[--s+ +o]-=!0,e+=1}]+=(0==(i&=!1))%(i=i&&(i.a>>>=0))))}&&0<a;--a){switch(e=1+((e=1+e)+1),4/(i&&(i.b=n+-0))>>(0&(i&&(i[e=1+e,0-(-6&"24"*this)]=2)))){default:case e=1+e,!1<((i&&(i.null<<=!0))<!1):case e=1+e,!1===(i%=!0<<([]==this)):case e=1+e,1&NaN%this/(i/=3):}e=1+e,i&&(i.c+=!1),e+=1}var t=["bar"!==this!=-26^!0,!0,!1,NaN,(e=1+((e=1+((e=1+(1+((e=1+e)+1)))+1))+1),f+=!1*(0!=(-5^n)))];for(var c in t){e=1+e;var f=t[c]}}(!1,"",{3:--s+(o&&o.in)}.a),console.log(null,100,s,1,1/0,NaN,void 0);})()
                                       ^

ReferenceError: f is not defined
    at evalmachine.<anonymous>:1:40
    at evalmachine.<anonymous>:1:786
minify(options):
{
  "compress": {
    "passes": 1000000,
    "unsafe": true
  },
  "toplevel": true
}
@alexlamsl alexlamsl added the bug label Jan 7, 2020
alexlamsl added a commit to alexlamsl/UglifyJS that referenced this issue Jan 7, 2020
alexlamsl added a commit that referenced this issue Jan 7, 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