<?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>78521</bug_id>
          
          <creation_ts>2012-02-13 13:21:53 -0800</creation_ts>
          <short_desc>The comment about terminating nulls at the top of CSSParser::lex() is incorrect</short_desc>
          <delta_ts>2012-02-16 23:48:20 -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>CSS</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</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>Trivial</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Cris Neckar">cdn</reporter>
          <assigned_to name="Cris Neckar">cdn</assigned_to>
          <cc>davidbarr</cc>
    
    <cc>eric</cc>
    
    <cc>macpherson</cc>
    
    <cc>menard</cc>
    
    <cc>webkit.review.bot</cc>
    
    <cc>zherczeg</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>555502</commentid>
    <comment_count>0</comment_count>
    <who name="Cris Neckar">cdn</who>
    <bug_when>2012-02-13 13:21:53 -0800</bug_when>
    <thetext>We should fix the comment 

// The input buffer is terminated by two \0, so
// it is safe to read two characters ahead anytime

at the top of CSSParser::lex(). It is wrong and suggests that there are 2 characters of nulls. This should probably say something like

// The input buffer is terminated by a \0 character, so
// it is safe to read one character ahead of a known non-null</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>556796</commentid>
    <comment_count>1</comment_count>
      <attachid>127087</attachid>
    <who name="Cris Neckar">cdn</who>
    <bug_when>2012-02-14 17:19:34 -0800</bug_when>
    <thetext>Created attachment 127087
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>558479</commentid>
    <comment_count>2</comment_count>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2012-02-16 13:36:24 -0800</bug_when>
    <thetext>Difficult for me to review this, because I don&apos;t know enough about lex().   Who creates this buffer?  Bison?  Can we point to the bison docs where it describes the buffer it creates?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>558520</commentid>
    <comment_count>3</comment_count>
    <who name="Cris Neckar">cdn</who>
    <bug_when>2012-02-16 14:23:46 -0800</bug_when>
    <thetext>(In reply to comment #2)
&gt; Difficult for me to review this, because I don&apos;t know enough about lex().   Who creates this buffer?  Bison?  Can we point to the bison docs where it describes the buffer it creates?

There is no real immediacy here as it is just a comment change. Zoltan can review this when he has time.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>558657</commentid>
    <comment_count>4</comment_count>
    <who name="David Barr">davidbarr</who>
    <bug_when>2012-02-16 16:31:08 -0800</bug_when>
    <thetext>I think the comment is right but the code is wrong.
CSSParser::lex depends on this invariant to detect the end of the buffer.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>558664</commentid>
    <comment_count>5</comment_count>
    <who name="Cris Neckar">cdn</who>
    <bug_when>2012-02-16 16:40:19 -0800</bug_when>
    <thetext>The one case where it depended on it was just changed. I&apos;m not sure whether it was originally supposed to be one or 2 nulls but at this point only one is written and lex() only relies on there being one.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>558694</commentid>
    <comment_count>6</comment_count>
    <who name="David Barr">davidbarr</who>
    <bug_when>2012-02-16 16:56:47 -0800</bug_when>
    <thetext>Thanks for the clarification, I see that dependence on double-null was removed recently:
http://trac.webkit.org/changeset/107369</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>558940</commentid>
    <comment_count>7</comment_count>
      <attachid>127087</attachid>
    <who name="Zoltan Herczeg">zherczeg</who>
    <bug_when>2012-02-16 22:55:32 -0800</bug_when>
    <thetext>Comment on attachment 127087
Patch

The double NULL originated from flex. The last comment here explains it:

http://stackoverflow.com/questions/1909166/how-to-parse-from-a-string-rather-than-a-file

When I started working on the lexer, I kept this behaviour first. Later I realized I didn&apos;t need double NULL terminator, but the comment was remained and the comment parsing was wrong.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>558965</commentid>
    <comment_count>8</comment_count>
      <attachid>127087</attachid>
    <who name="WebKit Review Bot">webkit.review.bot</who>
    <bug_when>2012-02-16 23:48:14 -0800</bug_when>
    <thetext>Comment on attachment 127087
Patch

Clearing flags on attachment: 127087

Committed r108043: &lt;http://trac.webkit.org/changeset/108043&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>558967</commentid>
    <comment_count>9</comment_count>
    <who name="WebKit Review Bot">webkit.review.bot</who>
    <bug_when>2012-02-16 23:48:20 -0800</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>127087</attachid>
            <date>2012-02-14 17:19:34 -0800</date>
            <delta_ts>2012-02-16 23:48:14 -0800</delta_ts>
            <desc>Patch</desc>
            <filename>bug-78521-20120214171933.patch</filename>
            <type>text/plain</type>
            <size>1286</size>
            <attacher name="Cris Neckar">cdn</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9XZWJDb3JlL0NoYW5nZUxvZwo9PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBTb3VyY2UvV2Vi
Q29yZS9DaGFuZ2VMb2cJKHJldmlzaW9uIDEwNzc0NSkKKysrIFNvdXJjZS9XZWJDb3JlL0NoYW5n
ZUxvZwkod29ya2luZyBjb3B5KQpAQCAtMSwzICsxLDEzIEBACisy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BjaGFyYWN0ZXJzIGFoZWFkIGFueXRpbWUuCisgICAgLy8gVGhlIGlucHV0IGJ1ZmZlciBp
cyB0ZXJtaW5hdGVkIGJ5IGEgXDAgY2hhcmFjdGVyLCBzbworICAgIC8vIGl0IGlzIHNhZmUgdG8g
cmVhZCBvbmUgY2hhcmFjdGVyIGFoZWFkIG9mIGEga25vd24gbm9uLW51bGwuCiAKICNpZm5kZWYg
TkRFQlVHCiAgICAgLy8gSW4gZGVidWcgd2UgY2hlY2sgd2l0aCBhbiBBU1NFUlQgdGhhdCB0aGUg
bGVuZ3RoIGlzID4gMCBmb3Igc3RyaW5nIHR5cGVzLgo=
</data>

          </attachment>
      

    </bug>

</bugzilla>