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

Closed
alexlamsl opened this issue Oct 2, 2022 · 0 comments · Fixed by #5693
Closed

ufuzz failure #5692

alexlamsl opened this issue Oct 2, 2022 · 0 comments · Fixed by #5693
Labels

Comments

@alexlamsl
Copy link
Collaborator

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

async function f0(undefined, bar) {
    function f1(arguments_1) {
        function f2(undefined) {
        }
        var b_2 = f2("a");
        async function f3(b_1, let_2) {
            {
                var expr2 = [ (c = 1 + c, (1 <= "undefined") / (NaN >>> 0), 23..toString() & [ , 0 ][1] & (b_1 && (b_1[c = 1 + c, 
                (5 / -3 ^ (5 || this)) - ((0 | 2) ^ 38..toString() / false)] = 25 / 4))) ];
                for await (var key2 of expr2) {
                    c = 1 + c, ((3 | -0) !== "function" <= 22) >= (bar = (bar = 3 || /[a2][^e]+$/) === [] % 5);
                }
            }
        }
        var bar_2 = f3();
        function f4(Infinity_2) {
        }
        var b_2 = f4();
        function f5(bar_2) {
            switch (c = 1 + c, ("undefined" & null) == -4 << 5 && (arguments_1 && ([ arguments_1.in ] = [ (bar_2 && (bar_2[c = 1 + c, 
            ("b" * "function" < (-5 & 4)) >>> ((bar && (bar[c = 1 + c, (c = c + 1, 
            -1 === 23..toString()) << ("c" > Infinity < (undefined **= "bar" << -0))] = 4 == "bar")) >>> true / 1)] &= 3 ^ "undefined")) > (c = c + 1, 
            "c") ]))) {
              case c = 1 + c, (3 + "function") % (this >>> -0) - ((bar_2 = "foo" !== -4) >= (bar_2 && (bar_2[c = 1 + c, 
                bar_2 && (bar_2[typeof f7 == "function" && --_calls_ >= 0 && f7({})] += (([ , 0 ].length === 2 && "b") !== -0 - "") * ("object" << "b" << 4 / 25))] = 25 != this))):
                ;
                break;

              case c = 1 + c, void (24..toString() << "" && (/[a2][^e]+$/ || 1)):
                ;
                break;

              case c = 1 + c, (("a" === 2) <= (22 == ([ , 0 ].length === 2))) + (2 < /[a2][^e]+$/ || 23..toString() && 5):
                ;

              case c = 1 + c, (-2 % 24..toString() >>> (-3 & 23..toString())) + ((b_2 += -2 / -2) != 3 % "c"):
                ;
                break;
            }
        }
        var bar = f5(arguments_1);
    }
    var yield_1 = f1(..."" + undefined, 0 === 1 ? a : b, -1);
    function f6(b_1) {
        {
            return "c";
        }
        [ (c = 1 + c, ([ , 0 ][1] - -4 === -0 - [ , 0 ][1]) > (-2 >>> NaN <= 3 - "bar")), (c = c + 1) + [ (c = 1 + c, 
        b_1 && (b_1.foo += ((0, 22) >> ("b" | false)) / (("c" ^ 3) != 24..toString() - ""))) ].undefined, --b + (b = a) ];
    }
    var foo_2 = f6();
}

var b_1 = f0(b = a);

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

async function f0(a, n) {
    var o, f = void 0;
    for await (o of [ (c = 1 + c, 0) ]) {
        c = 1 + c;
    }
    f = void 0, function() {
        switch (!1) {
          case "3function" % (this >>> -0) - (((!0)[c = 1 + (c = 1 + (c = 1 + c)), 
            (!0)["function" == typeof f7 && 0 <= --_calls_ && f7({})] += 0 * (-0 !== (2 === [ , 0 ].length && "b"))] = 25 != this) <= !0):
            break;

          case c = 1 + (c = 1 + c), 5 + (!1 <= (22 == (2 === [ , 0 ].length))):
          case c = 1 + c, 2047 + (NaN != (f += 1)):
        }
    }();
}

var b_1 = f0(b = a);

console.log(null, a, b, c, 1 / 0, NaN, void 0);
original result:
null 100 100 7 Infinity NaN undefined

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

// (beautified)
async function f0() {
    async function f3() {
        var expr2 = [];
        for await (var key2 of expr2) {}
    }
    f3();
    console.log();
}

f0();

console.log(undefined);
// output: 
// undefined
// 
// minify: undefined
// 
// 
// options: {
//   "compress": {
//     "passes": 1000000,
//     "sequences": 1000000,
//     "unsafe": true,
//     "unsafe_Function": true,
//     "unsafe_math": true,
//     "unsafe_proto": true,
//     "unsafe_regexp": true
//   },
//   "output": {
//     "v8": true
//   },
//   "validate": true
// }
minify(options):
{
  "compress": {
    "passes": 1000000,
    "sequences": 1000000,
    "unsafe": true,
    "unsafe_Function": true,
    "unsafe_math": true,
    "unsafe_proto": true,
    "unsafe_regexp": true
  },
  "output": {
    "v8": true
  }
}

Suspicious compress options:
  awaits
  collapse_vars
  evaluate
  inline
  passes
  reduce_vars
  unsafe
  unused
@alexlamsl alexlamsl added the bug label Oct 2, 2022
alexlamsl added a commit to alexlamsl/UglifyJS that referenced this issue Oct 2, 2022
alexlamsl added a commit to alexlamsl/UglifyJS that referenced this issue Oct 2, 2022
alexlamsl added a commit to alexlamsl/UglifyJS that referenced this issue Oct 2, 2022
alexlamsl added a commit to alexlamsl/UglifyJS that referenced this issue Oct 2, 2022
alexlamsl added a commit that referenced this issue Oct 3, 2022
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