Title: [115602] trunk/Source/WebCore
Revision
115602
Author
macpher...@chromium.org
Date
2012-04-29 18:28:34 -0700 (Sun, 29 Apr 2012)

Log Message

Initialize member variables in CSSParser's constructor.
https://bugs.webkit.org/show_bug.cgi?id=84377

Reviewed by Kentaro Hara.

It is good practice not to leave member variables uninitialized. They make debugging more difficult by reducing
repeatability, and in some cases lead to the possibility of information leakage occuring. This patch simply adds
initialization of m_numParsedPropertiesBeforeMarginBox to CSSParser's constructor to INVALID_NUM_PARSED_PROPERTIES
so that the initial state is the same as the state after the properties are cleared.

No tests added because this is a code style fix, not an actual bug so long as the bison generated code calls
startDeclarationsForMarginBox() and endDeclarationsForMarginBox() symmetrically. The lack of initialization was
originally detected by coverity.

* css/CSSParser.cpp:
(WebCore::CSSParser::CSSParser):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (115601 => 115602)


--- trunk/Source/WebCore/ChangeLog	2012-04-30 01:22:08 UTC (rev 115601)
+++ trunk/Source/WebCore/ChangeLog	2012-04-30 01:28:34 UTC (rev 115602)
@@ -1,3 +1,22 @@
+2012-04-29  Luke Macpherson  <macpher...@chromium.org>
+
+        Initialize member variables in CSSParser's constructor.
+        https://bugs.webkit.org/show_bug.cgi?id=84377
+
+        Reviewed by Kentaro Hara.
+
+        It is good practice not to leave member variables uninitialized. They make debugging more difficult by reducing
+        repeatability, and in some cases lead to the possibility of information leakage occuring. This patch simply adds
+        initialization of m_numParsedPropertiesBeforeMarginBox to CSSParser's constructor to INVALID_NUM_PARSED_PROPERTIES
+        so that the initial state is the same as the state after the properties are cleared.
+
+        No tests added because this is a code style fix, not an actual bug so long as the bison generated code calls
+        startDeclarationsForMarginBox() and endDeclarationsForMarginBox() symmetrically. The lack of initialization was
+        originally detected by coverity.
+
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::CSSParser):
+
 2012-04-29  Kent Tamura  <tk...@chromium.org>
 
         [Mac] Add LocalizedDateMac

Modified: trunk/Source/WebCore/css/CSSParser.cpp (115601 => 115602)


--- trunk/Source/WebCore/css/CSSParser.cpp	2012-04-30 01:22:08 UTC (rev 115601)
+++ trunk/Source/WebCore/css/CSSParser.cpp	2012-04-30 01:28:34 UTC (rev 115602)
@@ -222,6 +222,7 @@
     , m_id(CSSPropertyInvalid)
     , m_styleSheet(0)
     , m_selectorListForParseSelector(0)
+    , m_numParsedPropertiesBeforeMarginBox(INVALID_NUM_PARSED_PROPERTIES)
     , m_inParseShorthand(0)
     , m_currentShorthand(CSSPropertyInvalid)
     , m_implicitShorthand(false)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to