Minor Fix in RegexpObject Match

Signed-off-by: bence gabor kis <kisbg@inf.u-szeged.hu>
This commit is contained in:
bence gabor kis 2020-02-18 07:59:30 +01:00 committed by Patrick Kim
commit 81a0e9e1ca
3 changed files with 3 additions and 6 deletions

View file

@ -337,6 +337,7 @@ bool RegExpObject::match(ExecutionState& state, String* str, RegexMatchResult& m
size_t start = startIndex;
unsigned result = 0;
bool isGlobal = option() & RegExpObject::Option::Global;
bool isSticky = option() & RegExpObject::Option::Sticky;
bool gotResult = false;
bool reachToEnd = false;
unsigned* outputBuf = ALLOCA(sizeof(unsigned) * 2 * (subPatternNum + 1), unsigned int, state);
@ -378,7 +379,7 @@ bool RegExpObject::match(ExecutionState& state, String* str, RegexMatchResult& m
if (UNLIKELY(testOnly)) {
// outputBuf[1] should be set to lastIndex
if (isGlobal) {
if (isGlobal || isSticky) {
setLastIndex(state, Value(outputBuf[1]));
}
if (!lastParenInvalid && subPatternNum) {