diff options
Diffstat (limited to 'Source/JavaScriptCore/yarr/YarrInterpreter.cpp')
-rw-r--r-- | Source/JavaScriptCore/yarr/YarrInterpreter.cpp | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/Source/JavaScriptCore/yarr/YarrInterpreter.cpp b/Source/JavaScriptCore/yarr/YarrInterpreter.cpp index b6bfb2c98..a452bb7f2 100644 --- a/Source/JavaScriptCore/yarr/YarrInterpreter.cpp +++ b/Source/JavaScriptCore/yarr/YarrInterpreter.cpp @@ -565,7 +565,10 @@ public: if (matchEnd == -1) return true; - ASSERT((matchBegin == -1) || (matchBegin <= matchEnd)); + if (matchBegin == -1) + return true; + + ASSERT(matchBegin <= matchEnd); if (matchBegin == matchEnd) return true; @@ -607,7 +610,11 @@ public: int matchBegin = output[(term.atom.subpatternId << 1)]; int matchEnd = output[(term.atom.subpatternId << 1) + 1]; - ASSERT((matchBegin == -1) || (matchBegin <= matchEnd)); + + if (matchBegin == -1) + return false; + + ASSERT(matchBegin <= matchEnd); if (matchBegin == matchEnd) return false; @@ -1443,13 +1450,16 @@ public: int interpret() { + if (input.isNotAvailableInput(0)) + return -1; + + for (unsigned i = 0; i < pattern->m_body->m_numSubpatterns + 1; ++i) + output[i << 1] = -1; + allocatorPool = pattern->m_allocator->startAllocator(); if (!allocatorPool) CRASH(); - for (unsigned i = 0; i < ((pattern->m_body->m_numSubpatterns + 1) << 1); ++i) - output[i] = -1; - DisjunctionContext* context = allocDisjunctionContext(pattern->m_body.get()); JSRegExpResult result = matchDisjunction(pattern->m_body.get(), context, false); @@ -1462,7 +1472,6 @@ public: pattern->m_allocator->stopAllocator(); - // RegExp.cpp currently expects all error to be converted to -1. ASSERT((result == JSRegExpMatch) == (output[0] != -1)); return output[0]; } |