Changeset 21332 in webkit for trunk/JavaScriptCore/kjs/object.cpp


Ignore:
Timestamp:
May 9, 2007, 3:36:25 AM (18 years ago)
Author:
eseidel
Message:

2007-05-09 Eric Seidel <[email protected]>

Reviewed by mjs.


http://bugs.webkit.org/show_bug.cgi?id=6985
Cyclic proto values cause WebKit to hang

  • kjs/object.cpp: (KJS::JSObject::put): do a cycle check before setting proto
File:
1 edited

Legend:

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

    r20310 r21332  
    55 *  Copyright (C) 2001 Peter Kelly ([email protected])
    66 *  Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.
     7 *  Copyright (C) 2007 Eric Seidel ([email protected])
    78 *
    89 *  This library is free software; you can redistribute it and/or
     
    212213  // non-standard netscape extension
    213214  if (propertyName == exec->propertyNames().underscoreProto) {
     215    JSObject* proto = value->getObject();
     216    while (proto) {
     217      if (proto == this)
     218        throwError(exec, GeneralError, "cyclic __proto__ value");
     219      proto = proto->prototype() ? proto->prototype()->getObject() : 0;
     220    }
     221   
    214222    setPrototype(value);
    215223    return;
Note: See TracChangeset for help on using the changeset viewer.