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

Closed
alexlamsl opened this issue May 11, 2020 · 0 comments · Fixed by #3883
Closed

ufuzz failure #3882

alexlamsl opened this issue May 11, 2020 · 0 comments · Fixed by #3883
Labels

Comments

@alexlamsl
Copy link
Collaborator

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

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

var NaN = f0();

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

!function(o, n) {
    o++ + (o && (o[(t += 1) + o] = !1 < (o = !0))) && (t += 1), o && "function" == typeof o.NaN && 0 <= --i && o.NaN(1, 25, --n + {
        "": /[abc4]/.test("" + ((t += 1) + n++ || n || 5)),
        0: --n + [ --n + ((o && (o.Infinity += !1)) <= -1 & !1), (t += 1) + n--, (t += 1) + 1, delete o, "function" == typeof f1 && 0 <= --i && f1(void 0, (t = 1 + t, 
        o && (o[o && (o[[ !0 ^ !0 >>> this, o = 0, (o = !0)[t = 1 + ((t = 1 + ((t = 1 + (1 + t)) + 1)) + 1), 
        !0 >> (NaN <= (o && (o[t = 1 + t, 0] = 4)))] += !1, (t = 1 + t, o && (o[t = 1 + t, 
        !1] = !1), t += 1, t += 1), (t = 1 + t, o && (o[--n + o--] = 1 << 22)) ][0]] += !1 === (0 | -2 <= this)), 
        !0] = o && (o[--n + ~o] += 1) && o && (o.null = NaN >> (t += 1, 1 / 0)))), (t = 1 + t, 
        !0 * (this <= "foo") == 1)) ].foo,
        3: (o && (o.a /= 0), void (o && (o.undefined = 24))),
        in: null,
        "": o && "function" == typeof o.c && 0 <= --i && o.c("a", "object")
    });
}(), console.log(null, 100, 10, t, 1 / 0, void 0, void 0);


original result:
null 100 10 0 Infinity NaN undefined

uglified result:
null 100 10 0 Infinity undefined undefined
// reduced test case (output will differ)

// (beautified)
function f0(a) {
    console.log(a++);
    return a && this;
}

var NaN = f0();

console.log(NaN);
// output: NaN
// NaN
// 
// minify: NaN
// undefined
// 
// options: {
//   "compress": {
//     "passes": 1000000,
//     "unsafe": true
//   },
//   "toplevel": true
// }
minify(options):
{
  "compress": {
    "passes": 1000000,
    "unsafe": true
  },
  "toplevel": true
}

Suspicious compress options:
  evaluate
  passes
  reduce_vars
  sequences
  unsafe
  unused

Suspicious options:
  toplevel
@alexlamsl alexlamsl added the bug label May 11, 2020
alexlamsl added a commit to alexlamsl/UglifyJS that referenced this issue May 11, 2020
alexlamsl added a commit that referenced this issue May 11, 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