<?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>142160</bug_id>
          
          <creation_ts>2015-03-02 04:05:22 -0800</creation_ts>
          <short_desc>ASSERTION FAILED: charactersWritten &gt; 0 &amp;&amp; static_cast&lt;unsigned&gt;(charactersWritten) &lt; sizeof(buffer) in JSC::dateProtoFuncToISOString</short_desc>
          <delta_ts>2015-06-27 03:48:33 -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>Unspecified</rep_platform>
          <op_sys>Unspecified</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>116980</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Renata Hodovan">rhodovan.u-szeged</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ap</cc>
    
    <cc>benjamin</cc>
    
    <cc>ggaren</cc>
    
    <cc>mark.lam</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1073275</commentid>
    <comment_count>0</comment_count>
      <attachid>247657</attachid>
    <who name="Renata Hodovan">rhodovan.u-szeged</who>
    <bug_when>2015-03-02 04:05:22 -0800</bug_when>
    <thetext>Created attachment 247657
Test case

Load this script with debug jsc:

var d = new Date(0);
d.setUTCFullYear(-200e6);
d.toISOString();


Backtrace:

ASSERTION FAILED: charactersWritten &gt; 0 &amp;&amp; static_cast&lt;unsigned&gt;(charactersWritten) &lt; sizeof(buffer)
../../Source/JavaScriptCore/runtime/DatePrototype.cpp(542) : JSC::EncodedJSValue JSC::dateProtoFuncToISOString(JSC::ExecState*)
1   0x7ffff73f24ca /home/reni/data/REPOS/webkit/WebKitBuild/Debug/lib/libjavascriptcoregtk-4.0.so.18(WTFCrash+0x1e) [0x7ffff73f24ca]
2   0x7ffff724a1c9 /home/reni/data/REPOS/webkit/WebKitBuild/Debug/lib/libjavascriptcoregtk-4.0.so.18(_ZN3JSC24dateProtoFuncToISOStringEPNS_9ExecStateE+0x410) [0x7ffff724a1c9]
3   0x7fffadfff0a8 [0x7fffadfff0a8]

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff73f24cf in WTFCrash () at ../../Source/WTF/wtf/Assertions.cpp:321
321	    *(int *)(uintptr_t)0xbbadbeef = 0;
(gdb) bt
#0  0x00007ffff73f24cf in WTFCrash () at ../../Source/WTF/wtf/Assertions.cpp:321
#1  0x00007ffff724a1c9 in JSC::dateProtoFuncToISOString (exec=0x7fffffffca90) at ../../Source/JavaScriptCore/runtime/DatePrototype.cpp:542
#2  0x00007fffadfff0a8 in ?? ()
#3  0x00007fffffffcad0 in ?? ()
#4  0x00007ffff73a05ef in llint_entry () from /home/reni/data/REPOS/webkit/WebKitBuild/Debug/lib/libjavascriptcoregtk-4.0.so.18</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1074680</commentid>
    <comment_count>1</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2015-03-05 13:58:43 -0800</bug_when>
    <thetext>Which part of the assertion condition is untrue? That&apos;s sort of a big difference.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1074863</commentid>
    <comment_count>2</comment_count>
    <who name="Renata Hodovan">rhodovan.u-szeged</who>
    <bug_when>2015-03-06 00:09:29 -0800</bug_when>
    <thetext>(In reply to comment #1)
&gt; Which part of the assertion condition is untrue? That&apos;s sort of a big
&gt; difference.

The second part of the condition fails, since 30 characters was written but the size if the buffer is only 28. (However, this case is handled in the next line so we don&apos;t end up in a crash in release.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1075723</commentid>
    <comment_count>3</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2015-03-09 12:54:33 -0700</bug_when>
    <thetext>I see, it&apos;s an snprintf, and we have a check later, so no buffer overrun.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1105168</commentid>
    <comment_count>4</comment_count>
    <who name="Renata Hodovan">rhodovan.u-szeged</who>
    <bug_when>2015-06-27 03:48:33 -0700</bug_when>
    <thetext>Cannot repro this anymore.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>247657</attachid>
            <date>2015-03-02 04:05:22 -0800</date>
            <delta_ts>2015-03-02 04:05:22 -0800</delta_ts>
            <desc>Test case</desc>
            <filename>crash.js</filename>
            <type>application/javascript</type>
            <size>63</size>
            <attacher name="Renata Hodovan">rhodovan.u-szeged</attacher>
            
              <data encoding="base64">dmFyIGQgPSBuZXcgRGF0ZSgwKTsKZC5zZXRVVENGdWxsWWVhcigtMjAwZTYpOwpkLnRvSVNPU3Ry
aW5nKCk7
</data>

          </attachment>
      

    </bug>

</bugzilla>