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

Closed
alexlamsl opened this issue May 4, 2021 · 0 comments · Fixed by #4909
Closed

ufuzz failure #4908

alexlamsl opened this issue May 4, 2021 · 0 comments · Fixed by #4909
Labels

Comments

@alexlamsl
Copy link
Collaborator

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

{
    var brake1 = 5;
    do {
        break;
    } while (typeof f1 == "function" && --_calls_ >= 0 && f1(a++ + (typeof f0 == "function" && --_calls_ >= 0 && f0())) && --brake1 > 0);
}

var b_2 = b = a, b = [ b_2 && typeof b_2.a == "function" && --_calls_ >= 0 && b_2.a(), , (c = c + 1) + ((c = c + 1) + (b >>>= a)) ];

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

do {
    break;
} while ("function" == typeof f1 && 0 <= --f && f1(n++ + ("function" == typeof f0 && 0 <= --f && f0())) && 0 < --e);

o = [ n && "function" == typeof n.a && 0 <= --f && (o = n).a(), , 1 + (2 + (o >>>= n)) ];

console.log(null, n, o, 2, Infinity, NaN, undefined);
original result:
null 100 { '0': false, '2': 9 } 2 Infinity NaN undefined

uglified result:
null 100 { '0': false, '2': 3 } 2 Infinity NaN undefined
// reduced test case (output will differ)

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

var brake1 = 0;

0 && a++;

var b_2 = b = a, b = [ b_2 && b_2, b >>>= 0 ];

console.log(b);
// output: { '0': 0, '1': 0 }
// 
// minify: { '0': 0, '1': 1 }
// 
// options: {
//   "ie8": true,
//   "toplevel": true,
//   "mangle": {
//     "v8": true
//   },
//   "output": {
//     "v8": true
//   },
//   "validate": true
// }
minify(options):
{
  "ie8": true,
  "toplevel": true,
  "mangle": {
    "v8": true
  },
  "output": {
    "v8": true
  }
}

Suspicious compress options:
  collapse_vars
  join_vars
  reduce_vars

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