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

Closed
alexlamsl opened this issue Aug 18, 2022 · 0 comments · Fixed by #5624
Closed

ufuzz failure #5623

alexlamsl opened this issue Aug 18, 2022 · 0 comments · Fixed by #5624
Labels

Comments

@alexlamsl
Copy link
Collaborator

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

function f0() {
    {
        var expr1 = [];
        for (const key1 of expr1) {
            c = 1 + c;
            var yield = expr1[key1];
            var a = 0 === 1 ? a : b, NaN = ((c = c + 1) + void function() {
                c = c + 1;
            }() || 0).toString()[b = a];
        }
    }
    c = c + 1;
}

export var await = f0(typeof f0 == "function" && --_calls_ >= 0 && f0(!((await && (await[c = 1 + c, 
(23..toString() == Infinity) % ("number" * {}), ([ , 0 ][1], 4) + "function" * 24..toString()] %= "number" !== Infinity)) * ([] ^ 23..toString()) !== (this >>> "undefined" ^ -1 - "b")), 38..toString(), /[abc4]/.test(((await = await = b--) || b || 5).toString())));

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

function f0() {
    for (const o of []) {
        f = 1 + f, o, f += 1, f += 1;
    }
    f += 1;
}

o = f0(f0(o && (o[f = 1 + f, NaN] %= !0), ((o = n--) || n || 5).toString())), console.log(null, 100, 10, f, Infinity, NaN, void 0);

export {
    o as await
};
original result:
null 100 9 2 Infinity NaN undefined

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

// (beautified)
var b = 0;

function f0() {
    var expr1 = [];
    for (const key1 of expr1) {
        var a = b, NaN = b = a;
    }
}

f0 && f0((b-- || b).toString());

console.log(b);
// output: -1
// 
// minify: 0
// 
// options: {
//   "compress": {
//     "hoist_vars": true,
//     "keep_infinity": true,
//     "passes": 1000000,
//     "unsafe": true
//   },
//   "keep_fargs": true,
//   "keep_fnames": true,
//   "toplevel": true,
//   "mangle": {
//     "v8": true
//   },
//   "output": {
//     "v8": true
//   },
//   "validate": true
// }
minify(options):
{
  "compress": {
    "hoist_vars": true,
    "keep_infinity": true,
    "passes": 1000000,
    "unsafe": true
  },
  "keep_fargs": true,
  "keep_fnames": true,
  "toplevel": true,
  "mangle": {
    "v8": true
  },
  "output": {
    "v8": true
  }
}

Suspicious compress options:
  collapse_vars
  conditionals
  evaluate
  hoist_vars
  passes
  pure_getters
  reduce_vars
  unsafe
  unused

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