Skip to content

ufuzz failure #5716

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

Closed
alexlamsl opened this issue Oct 19, 2022 · 0 comments · Fixed by #5717
Closed

ufuzz failure #5716

alexlamsl opened this issue Oct 19, 2022 · 0 comments · Fixed by #5717
Labels

Comments

@alexlamsl
Copy link
Collaborator

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

function* f0() {
    var a = --b + ("" in [ , Infinity_1 && Infinity_1.then, (c = c + 1) + --b ]), Infinity_1 = !function() {
        {
            return a++ + (b = a);
        }
    }();
}

var await_2 = f0().next().done;

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

(function*() {
    var n = --e + ("" in [ , n, (i += 1) + --e ]);
    e = ++g;
})().next().done;

console.log(null, 100, e, i, Infinity, NaN, undefined);
original result:
null 100 10 1 Infinity NaN undefined

uglified result:
evalmachine.<anonymous>:2
var e=10,i=0;(function*(){var n=--e+(""in[,n,(i+=1)+--e]);e=++g})().next().done;console.log(null,100,e,i,Infinity,NaN,undefined);
                                                          ^

ReferenceError: g is not defined
    at evalmachine.<anonymous>:2:59
    at Generator.next (<anonymous>)
    at evalmachine.<anonymous>:2:69
    at evalmachine.<anonymous>:3:3
    at ContextifyScript.Script.runInContext (vm.js:59:29)
    at Object.runInContext (vm.js:120:6)
    at run_code_vm (/home/runner/work/UglifyJS/UglifyJS/test/sandbox.js:263:12)
    at Object.exports.run_code (/home/runner/work/UglifyJS/UglifyJS/test/sandbox.js:36:38)
    at run_code (/home/runner/work/UglifyJS/UglifyJS/test/ufuzz/index.js:2122:20)
    at /home/runner/work/UglifyJS/UglifyJS/test/ufuzz/index.js:2569:29
// reduced test case (output will differ)

// (beautified)
function* f0() {
    var a = [ Infinity_1 && Infinity_1 ], Infinity_1 = function() {
        return a++ + (b = a);
    }();
}

f0().next();
// output: 
// minify: ReferenceError: c is not defined
// options: {
//   "ie": true,
//   "toplevel": true,
//   "mangle": {
//     "v8": true
//   },
//   "output": {
//     "v8": true
//   },
//   "validate": true
// }
minify(options):
{
  "ie": true,
  "toplevel": true,
  "mangle": {
    "v8": true
  },
  "output": {
    "v8": true
  }
}

Suspicious compress options:
  collapse_vars
  inline
  merge_vars
  reduce_vars
  unused

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