Changeset 34069 in webkit for trunk/JavaScriptCore/VM/Machine.cpp


Ignore:
Timestamp:
May 23, 2008, 2:38:30 AM (17 years ago)
Author:
[email protected]
Message:

Fix <rdar://problem/5954997> global-recursion-on-full-stack.html crashes under guardmalloc.

Growing the register file with uncheckedGrow from within Machine::execute is not safe as the
register file may be too close to its maximum size to grow successfully. By using grow,
checking the result and throwing a stack overflow error we can avoid crashing.

Reviewed by Oliver Hunt.

  • VM/Machine.cpp:

(KJS::Machine::execute):

  • VM/RegisterFile.h: Remove the now-unused uncheckedGrow.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/VM/Machine.cpp

    r34067 r34069  
    657657    registerFile->addGlobalSlots(codeBlock->numVars);
    658658
    659     registerFile->uncheckedGrow(codeBlock->numTemporaries);
     659    if (!registerFile->grow(codeBlock->numTemporaries)) {
     660        registerFileStack->popGlobalRegisterFile();
     661        *exception = createStackOverflowError(exec);
     662        return 0;
     663    }
    660664    Register* r = (*registerFile->basePointer());
    661665
Note: See TracChangeset for help on using the changeset viewer.