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

Closed
alexlamsl opened this issue Jul 23, 2021 · 0 comments · Fixed by #5097
Closed

ufuzz failure #5096

alexlamsl opened this issue Jul 23, 2021 · 0 comments · Fixed by #5097
Labels

Comments

@alexlamsl
Copy link
Collaborator

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

{
    var brake1 = 5;
    do {
        {
            var brake2 = 5;
            while (typeof a_2 == "boolean" && --brake2 > 0) {}
        }
    } while ([ typeof a == "function" && --_calls_ >= 0 && a(false), typeof (a++ + [].a), +(("c" == Infinity) - (24..toString() & {}) < (c = c + 1, 
    /[a2][^e]+$/ - 4)), a++ + (typeof a == "function" && --_calls_ >= 0 && a((++a || a || 3).toString(), "function", -4)), (c = c + 1) + (a = function bar() {
        {
            var brake4 = 5;
            while ((c = c + 1) + (b = a) && --brake4 > 0) {
                var undefined_2;
            }
        }
    }) ] && --brake1 > 0);
}

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

do {
    for (o = 5; "boolean" == typeof a_2 && 0 < --o; ) {}
} while ("function" == typeof f && 0 <= --n && f(!1), f++, t += 1, "function" == typeof ++f && 0 <= --n && f((++f || f || 3).toString(), "function", -4), 
t += 1, f = function bar() {
    for (var o = 5; (t += 1) + f && 0 < --o; ) {}
}, 0 < --i);

console.log(null, f, 10, t, Infinity, NaN, void 0);
original result:
null function(){} function(){} 30 Infinity NaN undefined

uglified result:
null function(){} 10 30 Infinity NaN undefined
// reduced test case (output will differ)

// (beautified)
var a = 0, b = 0;

var brake1 = 5;

do {} while ([ typeof a == "function" && a(), a = function bar() {
    b = 1;
} ] && --brake1);

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

Suspicious compress options:
  evaluate
  passes
  reduce_vars
  side_effects

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