Skip to content

ufuzz failure #5716

Closed
Closed
@alexlamsl

Description

@alexlamsl
// 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions