<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>172572</bug_id>
          
          <creation_ts>2017-05-24 19:53:06 -0700</creation_ts>
          <short_desc>JSObject::getPropertySlot does not appear to access the prototype in a safe way</short_desc>
          <delta_ts>2017-05-31 15:32:55 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>JavaScriptCore</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>171759</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Saam Barati">saam</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>benjamin</cc>
    
    <cc>fpizlo</cc>
    
    <cc>ggaren</cc>
    
    <cc>gskachkov</cc>
    
    <cc>jfbastien</cc>
    
    <cc>keith_miller</cc>
    
    <cc>mark.lam</cc>
    
    <cc>msaboff</cc>
    
    <cc>ticaiolima</cc>
    
    <cc>ysuzuki</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1312500</commentid>
    <comment_count>0</comment_count>
    <who name="Saam Barati">saam</who>
    <bug_when>2017-05-24 19:53:06 -0700</bug_when>
    <thetext>It just accesses Structure&apos;s storedPrototype, which may not call the method table method.

See:
```
// It may seem crazy to inline a function this large but it makes a big difference
// since this is function very hot in variable lookup
ALWAYS_INLINE bool JSObject::getPropertySlot(ExecState* exec, PropertyName propertyName, PropertySlot&amp; slot)
{
    VM&amp; vm = exec-&gt;vm();
    auto&amp; structureIDTable = vm.heap.structureIDTable();
    JSObject* object = this;
    while (true) {
        if (UNLIKELY(TypeInfo::overridesGetOwnPropertySlot(object-&gt;inlineTypeFlags()))) {
            // If propertyName is an index then we may have missed it (as this loop is using
            // getOwnNonIndexPropertySlot), so we cannot safely call the overridden getOwnPropertySlot
            // (lest we return a property from a prototype that is shadowed). Check now for an index,
            // if so we need to start afresh from this object.
            if (std::optional&lt;uint32_t&gt; index = parseIndex(propertyName))
                return getPropertySlot(exec, index.value(), slot);
            // Safe to continue searching from current position; call getNonIndexPropertySlot to avoid
            // parsing the int again.
            return object-&gt;getNonIndexPropertySlot(exec, propertyName, slot);
        }
        ASSERT(object-&gt;type() != ProxyObjectType);
        Structure* structure = structureIDTable.get(object-&gt;structureID());
        if (object-&gt;getOwnNonIndexPropertySlot(vm, structure, propertyName, slot))
            return true;
        JSValue prototype = structure-&gt;storedPrototype();
        if (!prototype.isObject())
            break;
        object = asObject(prototype);
    }

    if (std::optional&lt;uint32_t&gt; index = parseIndex(propertyName))
        return getPropertySlot(exec, index.value(), slot);
    return false;
}
```</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1312721</commentid>
    <comment_count>1</comment_count>
    <who name="GSkachkov">gskachkov</who>
    <bug_when>2017-05-25 10:42:31 -0700</bug_when>
    <thetext>Is this issue connected to this https://bugs.webkit.org/show_bug.cgi?id=171915?</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>