Ignore:
Timestamp:
Apr 5, 2013, 2:34:15 PM (12 years ago)
Author:
[email protected]
Message:

If CallFrame::trueCallFrame() knows that it's about to read garbage instead of a valid CodeOrigin/InlineCallFrame, then it should give up and return 0 and all callers should be robust against this
https://bugs.webkit.org/show_bug.cgi?id=114062

Reviewed by Oliver Hunt.

  • bytecode/CodeBlock.h:

(JSC::CodeBlock::canGetCodeOrigin):
(CodeBlock):

  • interpreter/CallFrame.cpp:

(JSC::CallFrame::trueCallFrame):

  • interpreter/Interpreter.cpp:

(JSC::Interpreter::getStackTrace):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/interpreter/CallFrame.cpp

    r139541 r147798  
    122122       
    123123        bool hasCodeOrigin = machineCodeBlock->codeOriginForReturn(currentReturnPC, codeOrigin);
    124         ASSERT_UNUSED(hasCodeOrigin, hasCodeOrigin);
     124        ASSERT(hasCodeOrigin);
     125        if (!hasCodeOrigin) {
     126            // In release builds, if we find ourselves in a situation where the return PC doesn't
     127            // correspond to a valid CodeOrigin, we return zero instead of continuing. Some of
     128            // the callers of trueCallFrame() will be able to recover and do conservative things,
     129            // while others will crash.
     130            return 0;
     131        }
    125132    } else {
    126133        unsigned index = codeOriginIndexForDFG();
     134        ASSERT(machineCodeBlock->canGetCodeOrigin(index));
     135        if (!machineCodeBlock->canGetCodeOrigin(index)) {
     136            // See above. In release builds, we try to protect ourselves from crashing even
     137            // though stack walking will be goofed up.
     138            return 0;
     139        }
    127140        codeOrigin = machineCodeBlock->codeOrigin(index);
    128141    }
Note: See TracChangeset for help on using the changeset viewer.