Bug 895660 - Detect LinkBuffer OOM. r=nbp

This commit is contained in:
Sean Stangl 2013-10-01 14:12:05 -07:00
parent 8c30d76bc7
commit f3411c98be
2 changed files with 12 additions and 1 deletions

View File

@ -192,6 +192,11 @@ public:
return CodeLocationLabel(code());
}
// Useful as a proxy to detect OOM.
void* unsafeCode() {
return code();
}
protected:
// Keep this private! - the underlying code should only be obtained externally via
// finalizeCode() or finalizeCodeAddendum().

View File

@ -2688,10 +2688,16 @@ public:
backtrack();
// Link & finalize the code.
// XXX yarr-oom
ExecutablePool *pool;
bool ok;
LinkBuffer linkBuffer(this, globalData->regexAllocator, &pool, &ok, REGEXP_CODE);
// Attempt to detect OOM during linkBuffer creation.
if (linkBuffer.unsafeCode() == nullptr) {
jitObject.setFallBack(true);
return;
}
m_backtrackingState.linkDataLabels(linkBuffer);
if (compileMode == MatchOnly) {