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

Regex causes ChakraCore to exit process #4538

Closed
ghost opened this issue Jan 12, 2018 · 6 comments
Closed

Regex causes ChakraCore to exit process #4538

ghost opened this issue Jan 12, 2018 · 6 comments

Comments

@ghost
Copy link

ghost commented Jan 12, 2018

Calling RunScript on the following JavaScript causes ChakraCore to exit the process, no exception is thrown. If "x2|" is removed from the regex the issue does not repro. This script works correctly on Chakra.dll

var f = function (x) { var str = " droid24gP xh06build/"; var reg = /\s(milestone|droid(?:[2-4x]|\s(?:bionic|x2|pro|razr))?(:?\s4g)?)[\w\s]+build//i; return str.search(reg); }

@jackhorton
Copy link
Contributor

@dilijev ?

@dilijev dilijev self-assigned this Jan 17, 2018
@dilijev dilijev added this to the 1.8 milestone Jan 17, 2018
@dilijev
Copy link
Contributor

dilijev commented Jan 17, 2018

@rodrigoamicrosoft which version of ChakraCore.dll are you using? (And for completeness re: version of Chakra.dll which build of Windows are you on? i.e. as seen from winver)

Are you hosting ChakraCore.dll and just calling RunScript on that snippet? Did you then attempt to call the function you created or did it crash first? Can you repro in any version of ch.exe?

The closest thing I have to a repro[1] of this behavior is an overzealous FailFast[2], as we considered a certain regex compilation path to be a fatal unrecoverable state. This logic was only problematic in certain versions of release/1.8 between 2017-10 and 2017-12. No version of release/1.7 had this issue.

In particular I have a repro[1] from debug and release builds of 03a34a9

We have since fixed the underlying issue so that this FailFast check should not fire anymore. The latest builds from release/1.8 would not have this issue, if this FailFast is the root cause.

The FailFast was added here: #3924
Logic fixed in: #4411

/cc @Penguinwizzard

[1] I had to escape the slash at the end of the regex because as written it parses as <regex> / i and we get an error for not defined i if we try to call the function and otherwise it parses correctly. Not sure if there is different parsing logic for the RunScript (I would doubt it is different.)
[2] A FailFast intentionally crashes the engine. In this case it was actually an AssertOrFailFastMsg, which is an AssertMsg in debug builds and FailFast in release builds.

@dilijev
Copy link
Contributor

dilijev commented Jan 17, 2018

Removed External Contributor tag because this is not a PR.

@dilijev dilijev modified the milestones: 1.8, vNext Jan 17, 2018
@dilijev
Copy link
Contributor

dilijev commented Jan 17, 2018

Sounds like this is either fixed (FailFast mentioned above) or repros only in ChakraCore.dll (not Chakra.dll), so not a priority for release/1.8. I will continue to investigate and, if deemed a high priority, will escalate.

@dilijev
Copy link
Contributor

dilijev commented Feb 12, 2018

@rodrigoamicrosoft could you confirm whether your issue repros in the latest builds?

@dilijev
Copy link
Contributor

dilijev commented Jun 7, 2018

@rodrigoamicrosoft Feel free to reopen this issue if you confirm that this still repros.

@dilijev dilijev closed this as completed Jun 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants