<?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>135049</bug_id>
          
          <creation_ts>2014-07-18 07:36:08 -0700</creation_ts>
          <short_desc>Division by zero in fast-dtoa.cc.</short_desc>
          <delta_ts>2015-01-27 23:03:01 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Web Template Framework</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>INVALID</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>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>peavo</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>achristensen</cc>
    
    <cc>ap</cc>
    
    <cc>benjamin</cc>
    
    <cc>bfulgham</cc>
    
    <cc>cmarcelo</cc>
    
    <cc>commit-queue</cc>
    
    <cc>darin</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1023253</commentid>
    <comment_count>0</comment_count>
    <who name="">peavo</who>
    <bug_when>2014-07-18 07:36:08 -0700</bug_when>
    <thetext>I occasionally get a divison by zero exception on line 445 in fast-dtoa.cc.

444	        while (*kappa &gt; 0) {
445	            int digit = integrals / divisor;
446	            buffer[*length] = &apos;0&apos; + digit;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1023255</commentid>
    <comment_count>1</comment_count>
      <attachid>235127</attachid>
    <who name="">peavo</who>
    <bug_when>2014-07-18 07:39:27 -0700</bug_when>
    <thetext>Created attachment 235127
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1023260</commentid>
    <comment_count>2</comment_count>
      <attachid>235127</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2014-07-18 08:26:36 -0700</bug_when>
    <thetext>Comment on attachment 235127
Patch

Could you also supply a test case? How did you discover this problem?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1023288</commentid>
    <comment_count>3</comment_count>
    <who name="">peavo</who>
    <bug_when>2014-07-18 10:32:10 -0700</bug_when>
    <thetext>(In reply to comment #2)
&gt; (From update of attachment 235127 [details])
&gt; Could you also supply a test case? How did you discover this problem?

I don&apos;t have a testcase available currently, but I can see if I can come up with one.
Before adding the check, I got the crash fairly often during &quot;normal&quot; browsing.
I don&apos;t remember any specific sites, though.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1023310</commentid>
    <comment_count>4</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2014-07-18 12:16:54 -0700</bug_when>
    <thetext>(In reply to comment #3)
&gt; Before adding the check, I got the crash fairly often during &quot;normal&quot; browsing.

I don’t think we have reports of this crash on Mac. I believe Intel processors raise an exception on division by zero, and that’s what Macs use. Is this code that’s not used in the Mac port?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1023625</commentid>
    <comment_count>5</comment_count>
      <attachid>235127</attachid>
    <who name="Benjamin Poulain">benjamin</who>
    <bug_when>2014-07-20 23:47:09 -0700</bug_when>
    <thetext>Comment on attachment 235127
Patch

First, I agree with Darin: this must have a test.

But even with the test, I do not believe this would be the right fix. If divisor is zero, that likely means the input is invalid. If that happen, we should handle that earlier in the stack (or maybe an early return in DigitGen()). I don&apos;t think you can just ignore this loop.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1023719</commentid>
    <comment_count>6</comment_count>
    <who name="">peavo</who>
    <bug_when>2014-07-21 11:08:26 -0700</bug_when>
    <thetext>(In reply to comment #5)

Thanks for reviewing :)

&gt; (From update of attachment 235127 [details])
&gt; First, I agree with Darin: this must have a test.
&gt; 
&gt; But even with the test, I do not believe this would be the right fix. If divisor is zero, that likely means the input is invalid. If that happen, we should handle that earlier in the stack (or maybe an early return in DigitGen()). I don&apos;t think you can just ignore this loop.

Sounds good, I will try get some more details on the crash, but &quot;unfortunately&quot; I haven&apos;t seen the crash the last couple of days ...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1064814</commentid>
    <comment_count>7</comment_count>
    <who name="">peavo</who>
    <bug_when>2015-01-27 23:03:01 -0800</bug_when>
    <thetext>I haven&apos;t seen this crash in a long time now, so I believe it has been fixed.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>235127</attachid>
            <date>2014-07-18 07:39:27 -0700</date>
            <delta_ts>2014-07-20 23:47:08 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-135049-20140718163857.patch</filename>
            <type>text/plain</type>
            <size>1232</size>
            <attacher>peavo</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9XVEYvQ2hhbmdlTG9nCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIFNvdXJjZS9XVEYvQ2hh
bmdlTG9nCShyZXZpc2lvbiAxNzEyMjApCisrKyBTb3VyY2UvV1RGL0NoYW5nZUxvZwkod29ya2lu
ZyBjb3B5KQpAQCAtMSwzICsxLDEyIEBACisyMDE0LTA3LTE4ICBwZWF2b0BvdXRsb29rLmNvbSAg
PHBlYXZvQG91dGxvb2suY29tPgorCisgICAgICAgIERpdmlzaW9uIGJ5IHplcm8gaW4gZmFzdC1k
dG9hLmNjLgorICAgICAgICBodHRwczovL2J1Z3Mud2Via2l0Lm9yZy9zaG93X2J1Zy5jZ2k/aWQ9
MTM1MDQ5CisKKyAgICAgICAgUmV2aWV3ZWQgYn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md0aF0gPSAnMCcg
KyBkaWdpdDsKICAgICAgICAgICAgICgqbGVuZ3RoKSsrOwo=
</data>
<flag name="review"
          id="259673"
          type_id="1"
          status="-"
          setter="benjamin"
    />
          </attachment>
      

    </bug>

</bugzilla>