Skip to content

Fix StackOverflow in variable parsing #7809

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

Open
wants to merge 2 commits into
base: dev/patch
Choose a base branch
from

Conversation

sovdeeth
Copy link
Member

@sovdeeth sovdeeth commented Apr 19, 2025

Description

The CSV parsing regex is extraordinarily slow at matching quoted variable names, to the point it causes StackOverflows that prevent variables from being loaded at all. This is due to the regex matching checking for "", then matching "" or a single character, and repeat for the next character, until it recurses too far. This PR fixes that by allowing the matching of multiple non-" characters between each "" check.


Target Minecraft Versions: any
Requirements: none
Related Issues: none

@sovdeeth sovdeeth added the bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. label Apr 19, 2025
@sovdeeth sovdeeth requested review from a team as code owners April 19, 2025 20:47
@sovdeeth sovdeeth requested review from UnderscoreTud and Pesekjak and removed request for a team April 19, 2025 20:47
@sovdeeth sovdeeth force-pushed the patch/fix-overflow-in-csv-parsing branch from bcd6538 to ce19947 Compare April 19, 2025 21:41
@sovdeeth sovdeeth changed the base branch from master to dev/patch April 19, 2025 21:44
Copy link
Contributor

@Burbulinis Burbulinis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not 10 lines, not 1 line, but 1 character 😀

@sovdeeth sovdeeth changed the title Fix StackOverflow in variable parsing by not using regex to match quoted variable names Fix StackOverflow in variable parsing Apr 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An issue that needs to be fixed. Alternatively, a PR fixing an issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants