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

Catastrophic backtracking in string.match and friends #261

Open
vgskye opened this issue Sep 19, 2024 · 3 comments
Open

Catastrophic backtracking in string.match and friends #261

vgskye opened this issue Sep 19, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@vgskye
Copy link

vgskye commented Sep 19, 2024

Bug Description

the lua built-in functions string.match and string.find take in patterns, which are matched using a backtracking matcher. a backtracking matcher can take exponential time to complete, effectively freezing the game even with very low instruction counts.

Reproduction Steps

  1. lower your own avatar's trust level
  2. /figura run string.find("this will run for at least three eternities", ".*.*.*.*.*.*.*.*.*.*z.*")
  3. observe that the game freezes

Log File

N/A

@vgskye vgskye added the bug Something isn't working label Sep 19, 2024
@TheBunnyMan123
Copy link
Contributor

Step 1: make a while true loop
Observe that the game freezes :trol:

fr though making patterns faster if possible would be cool

@UnlikePaladin
Copy link
Member

this isn't really a bug but things just being slow

@vgskye
Copy link
Author

vgskye commented Sep 19, 2024

Step 1: make a while true loop Observe that the game freezes :trol:

Due to instruction counting, such a construct will not freeze the game with low trust levels. as string pattern matching happens inside luaj itself, it is not counted against the instruction limit despite having the ability to take an arbitrarily long amount of time.

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

3 participants