<?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>17030</bug_id>
          
          <creation_ts>2008-01-27 03:46:18 -0800</creation_ts>
          <short_desc>Small buffer overflow within initialization</short_desc>
          <delta_ts>2008-02-27 09:14:34 -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>JavaScriptCore</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</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 name="Stephan Binner">stbinner</reporter>
          <assigned_to name="Alexey Proskuryakov">ap</assigned_to>
          <cc>ap</cc>
    
    <cc>ddkilzer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>68355</commentid>
    <comment_count>0</comment_count>
    <who name="Stephan Binner">stbinner</who>
    <bug_when>2008-01-27 03:46:18 -0800</bug_when>
    <thetext>The patch should say enough :-)....

--- JavaScriptCore/kjs/date_object.cpp  2008/01/16 12:24:15     1.1
+++ JavaScriptCore/kjs/date_object.cpp  2008/01/16 12:24:21
@@ -908,7 +908,7 @@
     // fall back to local timezone
     if (!haveTZ) {
         GregorianDateTime t;
-        memset(&amp;t, 0, sizeof(tm));
+        memset(&amp;t, 0, sizeof(t));
         t.monthDay = day;
         t.month = month;
         t.year = year - 1900;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68359</commentid>
    <comment_count>1</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2008-01-27 07:31:10 -0800</bug_when>
    <thetext>Wow, thanks for catching this!

AFAICT, on the Mac, these structs are the same - is struct tm bigger on Linux? Also, GregorianDateTime is initialized to zero anyway, so we should probably just take out the calls to memset here and elsewhere.

Would you be willing to submit this for review as described in &lt;http://webkit.org/coding/contributing.html&gt;?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68367</commentid>
    <comment_count>2</comment_count>
    <who name="Stephan Binner">stbinner</who>
    <bug_when>2008-01-27 11:31:21 -0800</bug_when>
    <thetext>On x86_64 it is.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68368</commentid>
    <comment_count>3</comment_count>
      <attachid>18723</attachid>
    <who name="Stephan Binner">stbinner</who>
    <bug_when>2008-01-27 11:32:28 -0800</bug_when>
    <thetext>Created attachment 18723
Same as in original post</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68372</commentid>
    <comment_count>4</comment_count>
      <attachid>18723</attachid>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2008-01-27 12:05:14 -0800</bug_when>
    <thetext>Comment on attachment 18723
Same as in original post

Instead of correcting memset usage, we should just remove it (not just here, but all the instances that were mistakenly used for GregorianDateTime initialization).

Also, the patch needs a change log.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>71470</commentid>
    <comment_count>5</comment_count>
      <attachid>19273</attachid>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2008-02-21 22:33:51 -0800</bug_when>
    <thetext>Created attachment 19273
proposed fix</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>72146</commentid>
    <comment_count>6</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2008-02-27 09:14:34 -0800</bug_when>
    <thetext>Committed revision 30625.

</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>18723</attachid>
            <date>2008-01-27 11:32:28 -0800</date>
            <delta_ts>2008-02-21 22:33:51 -0800</delta_ts>
            <desc>Same as in original post</desc>
            <filename>data_object.diff</filename>
            <type>text/plain</type>
            <size>390</size>
            <attacher name="Stephan Binner">stbinner</attacher>
            
              <data encoding="base64">LS0tIEphdmFTY3JpcHRDb3JlL2tqcy9kYXRlX29iamVjdC5jcHAgIDIwMDgvMDEvMTYgMTI6MjQ6
MTUgICAgIDEuMQorKysgSmF2YVNjcmlwdENvcmUva2pzL2RhdGVfb2JqZWN0LmNwcCAgMjAwOC8w
MS8xNiAxMjoyNDoyMQpAQCAtOTA4LDcgKzkwOCw3IEBACiAgICAgLy8gZmFsbCBiYWNrIHRvIGxv
Y2FsIHRpbWV6b25lCiAgICAgaWYgKCFoYXZlVFopIHsKICAgICAgICAgR3JlZ29yaWFuRGF0ZVRp
bWUgdDsKLSAgICAgICAgbWVtc2V0KCZ0LCAwLCBzaXplb2YodG0pKTsKKyAgICAgICAgbWVtc2V0
KCZ0LCAwLCBzaXplb2YodCkpOwogICAgICAgICB0Lm1vbnRoRGF5ID0gZGF5OwogICAgICAgICB0
Lm1vbnRoID0gbW9udGg7CiAgICAgICAgIHQueWVhciA9IHllYXIgLSAxOTAwOwoK
</data>
<flag name="review"
          id="8179"
          type_id="1"
          status="-"
          setter="ap"
    />
          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>19273</attachid>
            <date>2008-02-21 22:33:51 -0800</date>
            <delta_ts>2008-02-21 23:51:00 -0800</delta_ts>
            <desc>proposed fix</desc>
            <filename>memset.txt</filename>
            <type>text/plain</type>
            <size>1456</size>
            <attacher name="Alexey Proskuryakov">ap</attacher>
            
              <data encoding="base64">SW5kZXg6IEphdmFTY3JpcHRDb3JlL0NoYW5nZUxvZwo9PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBKYXZhU2NyaX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DksNiBAQCBKU1ZhbHVlICpEYXRlT2JqZWN0RnVuY0ltcDo6
Y2FsbEFzRnVuY3RpCiAgICAgfQogCiAgICAgR3JlZ29yaWFuRGF0ZVRpbWUgdDsKLSAgICBtZW1z
ZXQoJnQsIDAsIHNpemVvZih0KSk7CiAgICAgaW50IHllYXIgPSBhcmdzWzBdLT50b0ludDMyKGV4
ZWMpOwogICAgIHQueWVhciA9ICh5ZWFyID49IDAgJiYgeWVhciA8PSA5OSkgPyB5ZWFyIDogeWVh
ciAtIDE5MDA7CiAgICAgdC5tb250aCA9IGFyZ3NbMV0tPnRvSW50MzIoZXhlYyk7CkBAIC05MTYs
NyArOTE1LDYgQEAgc3RhdGljIGRvdWJsZSBwYXJzZURhdGUoY29uc3QgVVN0cmluZyAmZAogICAg
IC8vIGZhbGwgYmFjayB0byBsb2NhbCB0aW1lem9uZQogICAgIGlmICghaGF2ZVRaKSB7CiAgICAg
ICAgIEdyZWdvcmlhbkRhdGVUaW1lIHQ7Ci0gICAgICAgIG1lbXNldCgmdCwgMCwgc2l6ZW9mKHRt
KSk7CiAgICAgICAgIHQubW9udGhEYXkgPSBkYXk7CiAgICAgICAgIHQubW9udGggPSBtb250aDsK
ICAgICAgICAgdC55ZWFyID0geWVhciAtIDE5MDA7Cg==
</data>
<flag name="review"
          id="8414"
          type_id="1"
          status="+"
          setter="sam"
    />
          </attachment>
      

    </bug>

</bugzilla>