Changeset 214714 in webkit


Ignore:
Timestamp:
Apr 1, 2017 1:14:15 AM (7 years ago)
Author:
gskachkov@gmail.com
Message:

Object with numerical keys with gaps gets filled by NaN values
https://bugs.webkit.org/show_bug.cgi?id=164412

Reviewed by Mark Lam.

This patch fixes issue when object have two properties
with name as number. The issue appears when during invoking
convertDoubleToArrayStorage, array is filled by pNaN and
method converting it to real NaN. This happeneds because a
pNaN in a Double array is a hole, and Double arrays cannot
have NaN values. To fix issue we need to check value and
clear it if it pNaN.

Source/JavaScriptCore:

  • runtime/JSObject.cpp:

(JSC::JSObject::convertDoubleToArrayStorage):

JSTests:

  • stress/object-number-properties.js: Added.
Location:
trunk
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChangeLog

    r214642 r214714  
     12017-04-01  Oleksandr Skachkov  <gskachkov@gmail.com>
     2
     3        Object with numerical keys with gaps gets filled by NaN values
     4        https://bugs.webkit.org/show_bug.cgi?id=164412
     5
     6        Reviewed by Merk Lam.
     7
     8        * stress/object-number-properties.js: Added.
     9        (assert):
     10        (boo):
     11
    1122017-03-30  Michael Saboff  <msaboff@apple.com>
    213
  • trunk/Source/JavaScriptCore/ChangeLog

    r214711 r214714  
     12017-04-01  Oleksandr Skachkov  <gskachkov@gmail.com>
     2
     3        Object with numerical keys with gaps gets filled by NaN values
     4        https://bugs.webkit.org/show_bug.cgi?id=164412
     5
     6        Reviewed by Mark Lam.
     7
     8        This patch fixes issue when object have two properties
     9        with name as number. The issue appears when during invoking
     10        convertDoubleToArrayStorage, array is filled by pNaN and
     11        method converting it to real NaN. This happeneds because a
     12        pNaN in a Double array is a hole, and Double arrays cannot
     13        have NaN values. To fix issue we need to check value and
     14        clear it if it pNaN.
     15
     16        * runtime/JSObject.cpp:
     17        (JSC::JSObject::convertDoubleToArrayStorage):
     18
    1192017-03-31  Saam Barati  <sbarati@apple.com>
    220
  • trunk/Source/JavaScriptCore/runtime/JSObject.cpp

    r214135 r214714  
    12891289    for (unsigned i = 0; i < vectorLength; i++) {
    12901290        double value = butterfly->contiguousDouble()[i];
     1291        if (value != value) {
     1292            newStorage->m_vector[i].clear();
     1293            continue;
     1294        }
    12911295        newStorage->m_vector[i].setWithoutWriteBarrier(JSValue(JSValue::EncodeAsDouble, value));
    1292         if (value == value)
    1293             newStorage->m_numValuesInVector++;
     1296        newStorage->m_numValuesInVector++;
    12941297    }
    12951298   
Note: See TracChangeset for help on using the changeset viewer.