<?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>23089</bug_id>
          
          <creation_ts>2009-01-03 06:11:43 -0800</creation_ts>
          <short_desc>[jsfunfuzz] tostring on large array causes oom hang/crash</short_desc>
          <delta_ts>2012-09-06 17:10:51 -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>528+ (Nightly build)</version>
          <rep_platform>Mac</rep_platform>
          <op_sys>OS X 10.5</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WORKSFORME</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>13638</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Oliver Hunt">oliver</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>barraclough</cc>
    
    <cc>darin</cc>
    
    <cc>jruderman</cc>
    
    <cc>mjs</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>104233</commentid>
    <comment_count>0</comment_count>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2009-01-03 06:11:43 -0800</bug_when>
    <thetext>switch(+(Array(2147483647))){default:}</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>104297</commentid>
    <comment_count>1</comment_count>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2009-01-03 20:11:49 -0800</bug_when>
    <thetext>Firefox produces a slow script warning on this example, we don&apos;t because Array.toString, etc are native code.

I&apos;m thinking that a hard cap on toString&apos;d array size + time out checks periodically in the toString conversion and what not would do the trick.  Anyone have any better ideas?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>104325</commentid>
    <comment_count>2</comment_count>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2009-01-04 07:17:33 -0800</bug_when>
    <thetext>Hmmm, it occurs to me that relying on the slow script dialog to kill execution won&apos;t work in the shell.

Also the code has a null check of the data for the buffer (to catch OOM) but vector growing uses the crashing version of malloc

Is it possible to make a vector use the non-throwing version?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>104326</commentid>
    <comment_count>3</comment_count>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2009-01-04 07:19:27 -0800</bug_when>
    <thetext>Also, for reference a JS version of Array.toString solves the hang by implicitly having timeout checks.  unfortunately it&apos;s 35% slower than the C++ version.  For compact (non-sparse) arrays it beats firefox though :D</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>104330</commentid>
    <comment_count>4</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2009-01-04 07:40:32 -0800</bug_when>
    <thetext>(In reply to comment #2)
&gt; Is it possible to make a vector use the non-throwing version?

Sure it&apos;s possible, but it changes the contract with clients.

What behavior are you suggesting when allocation fails? How will we update all the clients to work with the new behavior?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>104334</commentid>
    <comment_count>5</comment_count>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2009-01-04 08:15:24 -0800</bug_when>
    <thetext>(In reply to comment #4)
&gt; (In reply to comment #2)
&gt; &gt; Is it possible to make a vector use the non-throwing version?
&gt; 
&gt; Sure it&apos;s possible, but it changes the contract with clients.
&gt; 
&gt; What behavior are you suggesting when allocation fails? How will we update all
&gt; the clients to work with the new behavior?
&gt; 

No i dind&apos;t mean in general --i was asking (somewhat vaguely i guess)  whether there a template parameter or something that control which malloc a vector would use.

</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>104338</commentid>
    <comment_count>6</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2009-01-04 08:55:56 -0800</bug_when>
    <thetext>(In reply to comment #5)
&gt; No i dind&apos;t mean in general --i was asking (somewhat vaguely i guess)  whether
&gt; there a template parameter or something that control which malloc a vector
&gt; would use.

Sure, we could. But then we&apos;d still need to define what various operations do when allocation fails when that template parameter was set.

It might be better to have a completely separate class template. We could still share implementation with Vector.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>713854</commentid>
    <comment_count>7</comment_count>
    <who name="Gavin Barraclough">barraclough</who>
    <bug_when>2012-09-06 16:49:38 -0700</bug_when>
    <thetext>*** Bug 13638 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>713876</commentid>
    <comment_count>8</comment_count>
    <who name="Gavin Barraclough">barraclough</who>
    <bug_when>2012-09-06 17:10:51 -0700</bug_when>
    <thetext>This test case is equivalent to Array(2147483647).toString().  This completes with appropriate performance.  Works for me.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>