<?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>170264</bug_id>
          
          <creation_ts>2017-03-29 18:05:14 -0700</creation_ts>
          <short_desc>REGRESSION (Safari 10.1): Inserting elements into arrays fails when array contains very large numbers</short_desc>
          <delta_ts>2017-04-11 06:24:13 -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>Safari 10</version>
          <rep_platform>Mac</rep_platform>
          <op_sys>macOS 10.12</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>calvinlough</reporter>
          <assigned_to name="Saam Barati">saam</assigned_to>
          <cc>ap</cc>
    
    <cc>fpizlo</cc>
    
    <cc>gskachkov</cc>
    
    <cc>jonah</cc>
    
    <cc>M8ch88l</cc>
    
    <cc>minichate+webkit</cc>
    
    <cc>msaboff</cc>
    
    <cc>saam</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1292658</commentid>
    <comment_count>0</comment_count>
    <who name="">calvinlough</who>
    <bug_when>2017-03-29 18:05:14 -0700</bug_when>
    <thetext>The following code doesn&apos;t behave as expected on the latest version of Safari (10.1+) and on the WebKit nightly builds:

var arr = [0, 2147483648]; // NOTE: the second number is greater than a signed 32bit int
arr.shift(); // remove the first element so arr is [2147483648]
arr[1] = 1; // Safari fails to add the new element and the array is unchanged

On all other browsers and Safari 10.0, arr is [2147483648, 1]. On Safari 10.1 and newer, arr is [2147483648].

The above code works fine if the numbers in the array are less than 2147483648.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1293227</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2017-03-31 11:57:42 -0700</bug_when>
    <thetext>&lt;rdar://problem/31375593&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1293909</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Saboff">msaboff</who>
    <bug_when>2017-04-03 17:06:54 -0700</bug_when>
    <thetext>This is fixed with change set r214714 &lt;https://trac.webkit.org/changeset/214714&gt; and is a duplicate of &lt;https://bugs.webkit.org/show_bug.cgi?id=164412&gt;

*** This bug has been marked as a duplicate of bug 164412 ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1294012</commentid>
    <comment_count>3</comment_count>
    <who name="MikeM">M8ch88l</who>
    <bug_when>2017-04-04 03:03:26 -0700</bug_when>
    <thetext>Is this really a duplicate just because the fix of bug 164412 fixes this also.

This was an appalling bug which demonstrates the inadequacy of the test suite.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1294013</commentid>
    <comment_count>4</comment_count>
    <who name="Saam Barati">saam</who>
    <bug_when>2017-04-04 03:25:58 -0700</bug_when>
    <thetext>(In reply to MikeM from comment #3)
&gt; Is this really a duplicate just because the fix of bug 164412 fixes this
&gt; also.
Yes this is really the same bug. Note that a number larger than INT_MAX is stored using double representation.
&gt; 
&gt; This was an appalling bug which demonstrates the inadequacy of the test
&gt; suite.
WebKit is an open source project. You&apos;re more than welcome to add tests to help make the software better.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1294024</commentid>
    <comment_count>5</comment_count>
    <who name="MikeM">M8ch88l</who>
    <bug_when>2017-04-04 04:59:46 -0700</bug_when>
    <thetext>This should be marked as P1 as it&apos;s a serious security issue.

For example, crypto libraries must be considered broken. Safari needs to release an immediate fix, surely.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1294072</commentid>
    <comment_count>6</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2017-04-04 10:57:16 -0700</bug_when>
    <thetext>That would be a serious issue indeed. Do you have examples of broken websites or apps?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1294126</commentid>
    <comment_count>7</comment_count>
    <who name="MikeM">M8ch88l</who>
    <bug_when>2017-04-04 13:02:52 -0700</bug_when>
    <thetext>Well, it breaks my bignumber library which is downloaded from npm by about a million users a month.

https://github.com/MikeMcl/bignumber.js/issues/120
https://www.npmjs.com/package/bignumber.js</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1294160</commentid>
    <comment_count>8</comment_count>
    <who name="Saam Barati">saam</who>
    <bug_when>2017-04-04 14:10:26 -0700</bug_when>
    <thetext>gonna add this as a test.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1294164</commentid>
    <comment_count>9</comment_count>
      <attachid>306199</attachid>
    <who name="Saam Barati">saam</who>
    <bug_when>2017-04-04 14:13:23 -0700</bug_when>
    <thetext>Created attachment 306199
patch for test</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1294168</commentid>
    <comment_count>10</comment_count>
      <attachid>306201</attachid>
    <who name="Saam Barati">saam</who>
    <bug_when>2017-04-04 14:15:43 -0700</bug_when>
    <thetext>Created attachment 306201
patch with test</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1294697</commentid>
    <comment_count>11</comment_count>
    <who name="">jonah</who>
    <bug_when>2017-04-05 16:20:50 -0700</bug_when>
    <thetext>We also ran into this as users of https://www.npmjs.com/package/bignumber.js

This was painful to debug as the tab loading the library would hang with both the page content and developer tools becoming unresponsive so tracking down the source of the problem was not easy.

This mode of failure is also a complete blocker for any end user of the site in question. Rather than just encountering javascript errors any invocation of this behavior renders the entire page unusable.

As one consumer of bignumber.js we&apos;re temporarily disabling features to protect 10^5 users/month from being unable to use our product.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1294706</commentid>
    <comment_count>12</comment_count>
    <who name="Michael Saboff">msaboff</who>
    <bug_when>2017-04-05 16:34:27 -0700</bug_when>
    <thetext>Landed a test similar to what Saam posted with the exception that it loops to tier up.  This test landed change set r214977 &lt;https://trac.webkit.org/changeset/214977/webkit&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>306199</attachid>
            <date>2017-04-04 14:13:23 -0700</date>
            <delta_ts>2017-04-04 14:15:43 -0700</delta_ts>
            <desc>patch for test</desc>
            <filename>b-backup.diff</filename>
            <type>text/plain</type>
            <size>1379</size>
            <attacher name="Saam Barati">saam</attacher>
            
              <data encoding="base64">SW5kZXg6IEpTVGVzdHMvQ2hhbmdlTG9nCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIEpTVGVzdHMvQ2hhbmdlTG9n
CShyZXZpc2lvbiAyMTQ4OTYpCisrKyBKU1Rlc3RzL0NoYW5nZUxvZwkod29ya2luZyBjb3B5KQpA
QCAtMSwzICsxLDE0IEBACisyMDE3LTA0LTA0ICBTYWFtIEJhcmF0aSAgPHNiYXJhdGlAYXBwbGUu
Y29tPgorCisgICAgICAgIFJFR1JFU1NJT04gKFNhZmFyaSAxMC4xKTogSW5zZXJ0aW5nIGVsZW1l
bnRzIGludG8gYXJyYXlzIGZhaWxzIHdoZW4gYXJyYXkgY29udGFpbnMgdmVyeSBsYXJnZSBudW1i
ZXJzCisgICAgICAgIGh0dHBzOi8vYnVncy53ZWJraXQub3JnL3Nob3dfYnVnLmNnaT9pZD0xNzAy
NjQKKyAgICAgICAgPHJkYXI6Ly9wcm9ibGVtLzMxMzc1NTkzPgorCisgICAgICAgIFJldmlld2Vk
IGJ5IE5PQk9EWSAoT09QUyEpLgorCisgICA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9IDE7Cithc3NlcnQoYXJyLmxl
bmd0aCA9PT0gMik7Cithc3NlcnQoYXJyWzBdID09PSAyMTQ3NDgzNjQ4KTsKK2Fzc2VydChhcnJb
MV0gPT09IDEpOwo=
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>306201</attachid>
            <date>2017-04-04 14:15:43 -0700</date>
            <delta_ts>2017-04-05 16:32:14 -0700</delta_ts>
            <desc>patch with test</desc>
            <filename>b-backup.diff</filename>
            <type>text/plain</type>
            <size>1514</size>
            <attacher name="Saam Barati">saam</attacher>
            
              <data encoding="base64">SW5kZXg6IEpTVGVzdHMvQ2hhbmdlTG9nCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIEpTVGVzdHMvQ2hhbmdlTG9n
CShyZXZpc2lvbiAyMTQ4OTYpCisrKyBKU1Rlc3RzL0NoYW5nZUxvZwkod29ya2luZyBjb3B5KQpA
QCAtMSwzICsxLDE3IEBACisyMDE3LTA0LTA0ICBTYWFtIEJhcmF0aSAgPHNiYXJhdGlAYXBwbGUu
Y29tPgorCisgICAgICAgIFJFR1JFU1NJT04gKFNhZmFyaSAxMC4xKTogSW5zZXJ0aW5nIGVsZW1l
bnRzIGludG8gYXJyYXlzIGZhaWxzIHdoZW4gYXJyYXkgY29udGFpbnMgdmVyeSBsYXJnZSBudW1i
ZXJzCisgICAgICAgIGh0dHBzOi8vYnVncy53ZWJraXQub3JnL3Nob3dfYnVnLmNnaT9pZD0xNzAy
NjQKKyAgICAgICAgPHJkYXI6Ly9wcm9ibGVtLzMxMzc1NTkzPgorCisgICAgICAgIFJldmlld2Vk
IGJ5IE5PQk9EWSAoT09QUyEpLgorCisgICAgICAgIFRoZSBvcmlnaW5hbCBidWcgd2FzIGZpeGVk
IGluOiBodHRwczovL3RyYWMud2Via2l0Lm9yZy9jaGFuZ2VzZXQvMjE0NzE0CisgICAgIC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