Changeset 20043 in webkit


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

2007-03-07 Anrong Hu <huanr@yahoo.com>

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.
Location:
trunk/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r20026 r20043  
     12007-03-07  Anrong Hu  <huanr@yahoo.com>
     2
     3        Reviewed by Maciej.
     4
     5        Fix http://bugs.webkit.org/show_bug.cgi?id=12535
     6        Bug 12535: Stack-optimizing compilers can trick GC into freeing in-use objects
     7
     8        * kjs/internal.cpp:
     9        (KJS::StringImp::toObject): Copy val onto the stack so it is not subject to garbage collection.
     10
    1112007-03-07  Geoffrey Garen  <ggaren@apple.com>
    212
  • 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.