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

Closed
alexlamsl opened this issue Sep 17, 2022 · 0 comments · Fixed by #5667
Closed

ufuzz failure #5666

alexlamsl opened this issue Sep 17, 2022 · 0 comments · Fixed by #5667
Labels

Comments

@alexlamsl
Copy link
Collaborator

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

function f0() {
    {
        var brake1 = 5;
        while ((c = c + 1) + (c = c + 1, ([ , 0 ].length === 2 || -3) <= 25 + "object") && --brake1 > 0) {
            try {
                var a = (c = c + 1) + b--, bar = (c = c + 1) + ((c = c + 1) + void function() {
                    var async_2;
                }() ? b = a : a++ + (b = a));
            } catch (b) {}
        }
    }
}

var a_1 = f0();

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

(function f0() {
    for (var n, o = 5; (c += 1) + (c += 1, (2 === [ , 0 ].length || -3) <= "25object") && 0 < --o; ) {
        try {
            n = (c += 1) + t--, c = c + 1 + 1, t = n;
        } catch (n) {}
    }
})(), console.log(null, 100, t, c, Infinity, NaN, void 0);
original result:
null 100 56 22 Infinity NaN undefined

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

// (beautified)
var b;

function f0() {
    var brake1;
    var a = b, bar = console.log() ? b = a : a++ + (b = a);
}

f0();

console.log(b);
// output: 
// NaN
// 
// minify: 
// undefined
// 
// 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:
  conditionals
  passes
  reduce_vars
  side_effects
  unused
@alexlamsl alexlamsl added the bug label Sep 17, 2022
alexlamsl added a commit to alexlamsl/UglifyJS that referenced this issue Sep 17, 2022
alexlamsl added a commit that referenced this issue Sep 17, 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