Bug 470000 - JS_GET_SCRIPT_ATOM needs to use cx->fp safely, r=brendan
authorBenjamin Smedberg <benjamin@smedbergs.us>
Mon, 22 Dec 2008 11:07:40 -0500
changeset 22707 7e1aacdff6955e6918bb8614b15dbfbf428039aa
parent 22706 8feb9fdc3faf5c24e783c294d6d4da8a6d8c3cff
child 22708 ef44141222556b0bd152952786719245cf738b15
push id370
push userrsayre@mozilla.com
push dateWed, 07 Jan 2009 00:15:33 +0000
reviewersbrendan
bugs470000
milestone1.9.1b3pre
Bug 470000 - JS_GET_SCRIPT_ATOM needs to use cx->fp safely, r=brendan
js/src/jsscript.h
--- a/js/src/jsscript.h
+++ b/js/src/jsscript.h
@@ -153,17 +153,18 @@ StackDepth(JSScript *script)
      (JSObjectArray *)((uint8 *)(script) + (script)->regexpsOffset))
 
 #define JS_SCRIPT_TRYNOTES(script)                                            \
     (JS_ASSERT((script)->trynotesOffset != 0),                                \
      (JSTryNoteArray *)((uint8 *)(script) + (script)->trynotesOffset))
 
 #define JS_GET_SCRIPT_ATOM(script_, index, atom)                              \
     JS_BEGIN_MACRO                                                            \
-        if (cx->fp && cx->fp->imacpc && cx->fp->script == script_) {          \
+        JSStackFrame *fp_ = js_GetTopStackFrame(cx);                          \
+        if (fp_ && fp_->imacpc && fp_->script == script_) {                   \
             JS_ASSERT((size_t)(index) < js_common_atom_count);                \
             (atom) = COMMON_ATOMS_START(&cx->runtime->atomState)[index];      \
         } else {                                                              \
             JSAtomMap *atoms_ = &(script_)->atomMap;                          \
             JS_ASSERT((uint32)(index) < atoms_->length);                      \
             (atom) = atoms_->vector[index];                                   \
         }                                                                     \
     JS_END_MACRO