Ignore:
Timestamp:
Feb 12, 2016, 11:50:49 AM (10 years ago)
Author:
[email protected]
Message:

Fast path in JSObject::defineOwnIndexedProperty() forgets to check for the posibility of a descriptor that doesn't have a value
https://bugs.webkit.org/show_bug.cgi?id=154175
rdar://problem/24291497

Reviewed by Geoffrey Garen.

  • runtime/JSObject.cpp:

(JSC::JSObject::defineOwnIndexedProperty): Fix the bug.

  • runtime/SparseArrayValueMap.cpp:

(JSC::SparseArrayValueMap::putEntry): Catch the bug sooner in debug.
(JSC::SparseArrayValueMap::putDirect):

  • tests/stress/sparse-define-empty-descriptor.js: Added. This used to crash in release.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/SparseArrayValueMap.cpp

    r188532 r196490  
    11/*
    2  * Copyright (C) 2011, 2012 Apple Inc. All rights reserved.
     2 * Copyright (C) 2011, 2012, 2016 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    9191void SparseArrayValueMap::putEntry(ExecState* exec, JSObject* array, unsigned i, JSValue value, bool shouldThrow)
    9292{
     93    ASSERT(value);
     94   
    9395    AddResult result = add(array, i);
    9496    SparseArrayEntry& entry = result.iterator->value;
     
    109111bool SparseArrayValueMap::putDirect(ExecState* exec, JSObject* array, unsigned i, JSValue value, unsigned attributes, PutDirectIndexMode mode)
    110112{
     113    ASSERT(value);
     114   
    111115    AddResult result = add(array, i);
    112116    SparseArrayEntry& entry = result.iterator->value;
Note: See TracChangeset for help on using the changeset viewer.