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

Potential misuse of multi-byte character in regex.split #131

Open
sgbeal opened this issue Mar 1, 2020 · 2 comments
Open

Potential misuse of multi-byte character in regex.split #131

sgbeal opened this issue Mar 1, 2020 · 2 comments

Comments

@sgbeal
Copy link

sgbeal commented Mar 1, 2020

mujs/jsstring.c

Line 605 in 6f93cab

++a;

The ++a there is incrementing what could be, unless i'm sorely misunderstanding the code (which i might be), a multi-byte character, which would leave the next call to js_doregexec() the start of a string which is currently part of the way through a multi-byte character.

@avih
Copy link
Contributor

avih commented Mar 1, 2020

Keep in mind that currently mujs strings are CESU-8 which is different than UTF-8 for codepoints higher than U+FFFF, and mujs itself currently has a known issue when such codepoints appear in a source file (hopefully fixed soon).

This may or may not be related to your issue, but it is related to multibyte codepoint (specifically, 4 bytes codepoints).

@sgbeal
Copy link
Author

sgbeal commented Mar 2, 2020

i haven't had an issue with it, i just came across it while looking into #130 and it looked suspicious.

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

2 participants