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

Closed
alexlamsl opened this issue Jun 20, 2024 · 0 comments · Fixed by #5862
Closed

ufuzz failure #5860

alexlamsl opened this issue Jun 20, 2024 · 0 comments · Fixed by #5862
Labels

Comments

@alexlamsl
Copy link
Collaborator

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

void (a && ({
    in: a[(c = c + 1) + /[abc4]/g.exec((a++ + (a && typeof a.in == "function" && --_calls_ >= 0 && a.in(22)) || b || 5).toString())]
} = {
    in: (("b" ^ 3) & ("c" ^ 24..toString())) << (0 << "b") % ("a" ^ undefined)
}));

try {
    {
        var a = function foo(a_1, foo) {
            {
                var brake4 = 5;
                L16061: do {
                    typeof f0 == "function" && --_calls_ >= 0 && f0((a_1 >>>= delete [] && "a" != 23..toString()) ^ (foo && (foo[c = 1 + c, 
                    (a_1 && (a_1.get ^= 5 < /[a2][^e]+$/ ^ "c" != 4)) + ((this, 
                    22) != "" * null)] = false < 0) && 3 >> 25), typeof f1 == "function" && --_calls_ >= 0 && f1((c = c + 1) + delete b, {}, --b + [ (c = 1 + c, 
                    (c = c + 1, +[ , 0 ][1]) == delete ("" % 1)), (c = 1 + c, c = c + 1, 
                    (-0 ?? {}) !== ("number" && 25)) ].async));
                } while (a++ + (foo && foo[++a]) && --brake4 > 0);
            }
        }(a++ + (a && typeof a.b == "function" && --_calls_ >= 0 && a.b(25)));
    }
} finally {
    a?.[b = a];
}

{}

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

({
    in: a[(c += 1) + /[abc4]/g.exec((a++ + (a && "function" == typeof a.in && 0 <= --_calls_ && a.in(22)) || b || 5).toString())]
} = {
    in: 0
});

try {
    a = function(n, l) {
        for (var f = 5; "function" == typeof f0 && 0 <= --_calls_ && f0((n >>>= !0) ^ l, "function" == typeof f1 && 0 <= --_calls_ && f1((c += 1) + delete b, {}, --b + [ (c = 1 + c, 
        !1), (c = 1 + (c += 1), c += 1, !0) ].async)), a++ + l && 0 < --f; ) {}
    }(a++ + (a && "function" == typeof a.b && 0 <= --_calls_ && a.b(25)));
} finally {
    b = a;
}

console.log(null, a, b, c, 1 / 0, NaN, void 0);
original result:
null undefined 10 1 Infinity NaN undefined

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

// (beautified)
var a = 0;

a[0];

try {
    var a = function foo() {}();
} finally {
    a?.[0()];
}
// output: 
// minify: TypeError: 0 is not a function
// options: {
//   "compress": {
//     "passes": 1000000,
//     "sequences": 1000000,
//     "unsafe": true,
//     "unsafe_Function": true,
//     "unsafe_math": true,
//     "unsafe_proto": true,
//     "unsafe_regexp": true
//   },
//   "module": false,
//   "output": {
//     "v8": true
//   },
//   "validate": true
// }
minify(options):
{
  "compress": {
    "passes": 1000000,
    "sequences": 1000000,
    "unsafe": true,
    "unsafe_Function": true,
    "unsafe_math": true,
    "unsafe_proto": true,
    "unsafe_regexp": true
  },
  "module": false,
  "output": {
    "v8": true
  }
}

Suspicious compress options:
  collapse_vars
  evaluate
  passes
  pure_getters
  reduce_vars
  side_effects
@alexlamsl alexlamsl added the bug label Jun 20, 2024
alexlamsl added a commit to alexlamsl/UglifyJS that referenced this issue Jun 20, 2024
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