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

KopiLua string.gsub() "pattern too complex" error, update KopiLua_strlib? #318

Open
admalledd opened this issue Jan 31, 2023 · 0 comments
Open

Comments

@admalledd
Copy link

Reproduction lua, this should not throw/error. It is a valid regex and source string. There is some bug in the old-old (2015?) KopiLua_strlib.cs and it is loosing track of the input state.

var code = "string.gsub('some words for spacing error reasons <script>alert(""hello world"")</script>','^%s*(.-)%s*$','%1')";
var script = new Script();
script.DoString(code); //should not throw in this case

Sample code came after reproducing and narrowing some live-ish code I found while doing a security audit on regex complexities.

Upstream KopiLua seems to have an older PR that may fix this? https://github.com/NLua/KopiLua/pull/21/files but I haven't had a chance to merge-refactor it in to our local moonsharp fork yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant