RegExpCachedResult::setInput should reify left and right contexts
authorfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 30 Jun 2017 16:37:29 +0000 (16:37 +0000)
committerfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 30 Jun 2017 16:37:29 +0000 (16:37 +0000)
commit2149ed69907c3fbe9ccbb82ecd7f425f2ab2a3ed
treecf202713d01d101420154b9c8731bba17c0ae378
parent3dcad5b1c45f9215ca4116d110a9a1d07fcfd173
RegExpCachedResult::setInput should reify left and right contexts
https://bugs.webkit.org/show_bug.cgi?id=173818

Reviewed by Keith Miller.
JSTests:

* stress/right-left-context-invalidated-by-input.js: Added.
(test.validateContexts):
(test):

Source/JavaScriptCore:

If you don't reify them in setInput, then when you later try to reify them, you'll end up
using indices into an old input string to create a substring of a new input string. That
never goes well.

* runtime/RegExpCachedResult.cpp:
(JSC::RegExpCachedResult::setInput):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@219001 268f45cc-cd09-0410-ab3c-d52691b4dbfc
JSTests/ChangeLog
JSTests/stress/right-left-context-invalidated-by-input.js [new file with mode: 0644]
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/RegExpCachedResult.cpp