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

Stack overflow by the operator of =~ or !~. #293

Closed
Kray-G opened this issue May 19, 2021 · 1 comment
Closed

Stack overflow by the operator of =~ or !~. #293

Kray-G opened this issue May 19, 2021 · 1 comment
Assignees
Labels
bug Something isn't working
Milestone

Comments

@Kray-G
Copy link
Owner

Kray-G commented May 19, 2021

When using the operator of =~ or !~, the stack is not used cleanly.
It causes a stack overflow after a lot of operations by those operator like in a loop.

This should be also applied to v1.0.2 as a back port.

@Kray-G Kray-G added the bug Something isn't working label May 19, 2021
@Kray-G Kray-G added this to the v1.1.0 milestone May 19, 2021
@Kray-G Kray-G self-assigned this May 19, 2021
@Kray-G
Copy link
Owner Author

Kray-G commented May 19, 2021

Here is the code to be reproduced. Stack has been overflowed when unmatched after resetting a string in Regex.

var l = "aaaaaaa";
for (var i = 0; i < 1000; ++i) {
    if (g = (l =~ /([b-z]+)/)) {
        System.println(g[1].string);
    } else if (g = (l =~ /([0-9]+)/)) {
        System.println(g[1].string);
    }
}
System.println("Successful");

Kray-G added a commit that referenced this issue May 19, 2021
Kray-G added a commit that referenced this issue May 19, 2021
Kray-G added a commit that referenced this issue May 19, 2021
@Kray-G Kray-G closed this as completed in 97b1c0a May 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant