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

Closed
alexlamsl opened this issue Jul 30, 2024 · 0 comments · Fixed by #5896
Closed

ufuzz failure #5895

alexlamsl opened this issue Jul 30, 2024 · 0 comments · Fixed by #5896
Labels

Comments

@alexlamsl
Copy link
Collaborator

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

function f0() {
    for (var brake1 = 5; a++ + (a && typeof a.foo == "function" && --_calls_ >= 0 && a.foo((c = c + 1) + {
        a: a
    }.NaN, {}, a && typeof a.null == "function" && --_calls_ >= 0 && (-1, a.null)(--b + (a && a[(c = c + 1) + +function() {}()])))) && brake1 > 0; --brake1) {
        var brake2 = 5;
        L33862: while (b + 1 - .1 - .1 - .1 && --brake2 > 0) {
            try {
                return void function() {
                    {
                        var undefined_2 = function f1(bar) {
                            c = 1 + c, -0 in [] < (25 | [ , 0 ].length === 2) <= (([ , 0 ].length === 2) + 4 <= -4 % ([ 3n ][0] > 2));
                            c = 1 + c, (bar[a++ + {
                                done: (c = 1 + c, (bar = [ , 0 ][1] < 25 == /[a2][^e]+$/ >>> "object") > ((Infinity | 25) > (Number(0xdeadn << 16n | 0xbeefn) ^ NaN))),
                                3: (c = 1 + c, (c = c + 1, undefined) << -0 % 2, 
                                -4 + "" << ("a" ^ [ 3n ][0] > 2))
                            }[c = 1 + c, ([ , 0 ][1] >= 5) << (-4 !== Infinity) ^ (bar && (bar.undefined = ("function" || {}) * ("a" != [ , 0 ][1])))]] ^= (3 == "function") << ("" >> "object")) > (+"c" & !38..toString());
                            c = 1 + c, (("function" ^ -2) <= this >> /[a2][^e]+$/) * ("b" << /[a2][^e]+$/ || 3 != true);
                        }();
                    }
                    {
                        var expr9 = a++ + (undefined_2 = "object" in {});
                        for (var [ key9 ] in expr9) {
                            {
                                var foo_2 = function await_1(undefined_2_1, b_1, bar_1) {}((c = 1 + c, 
                                ("c" ^ Infinity) / ({} !== null) < (4 != NaN) >> ("a" != 0)));
                            }
                        }
                    }
                }();
            } catch (bar_1) {
                c = c + 1;
            }
        }
    }
}

var c_1 = f0(a++ + typeof {
    1.5: (c = c + 1) + (typeof f1 == "function" && --_calls_ >= 0 && f1()),
    "\t": {
        a: --b + /[abc4]/g.exec((--b + (23..toString() in []) || b || 5).toString()) ? (c = c + 1, 
        this && []) !== ((a = 23..toString() || [ , 0 ][1]) & [ , 0 ][1] <= 0) : (c = c + 1) + a++
    }[a && typeof a.b == "function" && --_calls_ >= 0 && a.b({}, --b + (b + 1 - .1 - .1 - .1), 25)],
    b: /[abc4]/g.exec((--b + {
        a: (a && (a.set = [ , 0 ][1] <= 23..toString() || (22 || 22))) >>> ((38..toString() < "bar") >> (4, 
        -2))
    }.in || b || 5).toString())
}[--b + undefined], [ , 0 ][1], 25);

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

function f0() {
    for (var brake1 = 5; a++ + (a && "function" == typeof a.foo && 0 <= --_calls_ && a.foo((c += 1) + {
        a: a
    }.NaN, {}, a && "function" == typeof a.null && 0 <= --_calls_ && (0, a.null)(--b + (a && a[(c += 1) + NaN])))) && 0 < brake1; --brake1) {
        for (var bar, key9, brake2 = 5; b + 1 - .1 - .1 - .1 && 0 < --brake2; ) {
            try {
                for ([ key9 ] in bar[a++ + {
                    done: (c = 1 + (c = 1 + (c = 1 + c)), (bar = !1) > ((NaN ^ Number(0xdeadn << 16n | 0xbeefn)) < 25)),
                    3: (c = 1 + c, "-4" << ("a" ^ 2 < 3n))
                }[c = 1 + (c += 1), 0 ^ (bar && (bar.undefined = NaN))]] ^= 0, 38..toString(), 
                c = 1 + c, a++ + ("object" in {})) {
                    c = 1 + c;
                }
                return;
            } catch (bar_1) {
                c += 1;
            }
        }
    }
}

var c_1 = f0(a++ + typeof {
    1.5: (c += 1) + ("function" == typeof f1 && 0 <= --_calls_ && f1()),
    "\t": {
        a: --b + /[abc4]/g.exec((--b + (23..toString() in []) || b || 5).toString()) ? (c += 1, 
        (this && []) !== (!0 & (a = 23..toString() || 0))) : (c += 1) + a++
    }[a && "function" == typeof a.b && 0 <= --_calls_ && a.b({}, --b + (b + 1 - .1 - .1 - .1), 25)],
    b: /[abc4]/g.exec((--b + {
        a: (a && (a.set = 0 <= 23..toString() || 22)) >>> ((38..toString() < "bar") >> -2)
    }.in || b || 5).toString())
}[--b + void 0], 0, 25);

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

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

// (beautified)
function f0() {
    while (1) {
        try {
            return function() {
                (function f1(bar) {
                    bar[bar = 0];
                })();
                for (var [ key9 ] in 0) {}
            }();
        } catch (bar_1) {}
    }
}

f0();
// output: Error: Script execution timed out after 100ms
// minify: 
// options: {
//   "mangle": false,
//   "module": false,
//   "output": {
//     "v8": true
//   },
//   "validate": true
// }
minify(options):
{
  "mangle": false,
  "module": false,
  "output": {
    "v8": true
  }
}

Suspicious compress options:
  inline
  sequences
  side_effects
  unused
@alexlamsl alexlamsl added the bug label Jul 30, 2024
alexlamsl added a commit to alexlamsl/UglifyJS that referenced this issue Jul 30, 2024
alexlamsl added a commit that referenced this issue Jul 30, 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