Ignore:
Timestamp:
Mar 7, 2007, 5:42:39 PM (18 years ago)
Author:
bdash
Message:

2007-03-07 Anrong Hu <[email protected]>

Reviewed by Maciej.

Fix http://bugs.webkit.org/show_bug.cgi?id=12535
Bug 12535: Stack-optimizing compilers can trick GC into freeing in-use objects

  • kjs/internal.cpp: (KJS::StringImp::toObject): Copy val onto the stack so it is not subject to garbage collection.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/internal.cpp

    r15482 r20043  
    7979JSObject *StringImp::toObject(ExecState *exec) const
    8080{
    81     return new StringInstance(exec->lexicalInterpreter()->builtinStringPrototype(), val);
     81    // Put the reference onto the stack so it is not subject to garbage collection.
     82    // <http://bugs.webkit.org/show_bug.cgi?id=12535>
     83    UString valCopy = val;
     84
     85    return new StringInstance(exec->lexicalInterpreter()->builtinStringPrototype(), valCopy);
    8286}
    8387
Note: See TracChangeset for help on using the changeset viewer.