<?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>22772</bug_id>
          
          <creation_ts>2008-12-09 17:07:24 -0800</creation_ts>
          <short_desc>Reads on uninitialised memory in CSS parser</short_desc>
          <delta_ts>2009-10-15 16:55:28 -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>New Bugs</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>30347</dup_id>
          
          <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>0</everconfirmed>
          <reporter name="Adam Langley">agl</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>mattm</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>102044</commentid>
    <comment_count>0</comment_count>
    <who name="Adam Langley">agl</who>
    <bug_when>2008-12-09 17:07:24 -0800</bug_when>
    <thetext>This issue is WebKit/WebCore/css/CSSParser.cpp:405

bool CSSParser::validUnit(CSSParserValue* value, Units unitflags, bool strict)
{
   if (unitflags &amp; FNonNeg &amp;&amp; value-&gt;fValue &lt; 0)
       return false;

   bool b = false;

Not all bytes of value-&gt;fValue are valid. The problem happens when
some CSS property is a function rather than a value. In this specific
case it&apos;s the width of something. (I&apos;m not claiming that this is valid
CSS, but it happens on nytimes.com).

value-&gt;fValue is a member of a union:

WebKit/WebCore/css/CSSParserValue.h:

struct CSSParserValue {
   int id;
   bool isInt;
   union {
       double fValue;
       int iValue;
       CSSParserString string;
       CSSParserFunction* function;
   };
   enum {
       Operator = 0x100000,
       Function = 0x100001,
       Q_EMS    = 0x100002
   };
   int unit;

   bool isVariable() const;

   PassRefPtr&lt;CSSValue&gt; createCSSValue();
};

Since it&apos;s a function, -&gt;function is set, but that&apos;s only a 32-bit
value on many platforms. However, the FNonNeg tests fValue, an 8-byte double, so
only half the bytes are valid. It turns out that it doesn&apos;t matter
because a CSSParserValue of type function will always end up returning
false later in the function. However, it might be a surprise for
someone down the road.

I think the best solution is probably to write a constructor for
CSSParserValue which initialises the members, although I really don&apos;t
know the code very well.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>121480</commentid>
    <comment_count>1</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2009-05-15 02:33:36 -0700</bug_when>
    <thetext>See also: bug 25812.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>154948</commentid>
    <comment_count>2</comment_count>
    <who name="Matt Mueller">mattm</who>
    <bug_when>2009-10-15 16:51:07 -0700</bug_when>
    <thetext>Should be fixed by bug 30347, if you could verify.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>154950</commentid>
    <comment_count>3</comment_count>
    <who name="Adam Langley">agl</who>
    <bug_when>2009-10-15 16:55:28 -0700</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of bug 30347 ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>