[Coverity] Fix uninitialized constructor defects in .../html
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Jan 2012 23:47:33 +0000 (23:47 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Jan 2012 23:47:33 +0000 (23:47 +0000)
https://bugs.webkit.org/show_bug.cgi?id=74965

Patch by Greg Billock <gbillock@google.com> on 2012-01-19
Reviewed by Simon Fraser.

Test: fast/canvas/script-tests/canvas-webkitLineDash.js

* html/HTMLFormCollection.cpp:
(WebCore::HTMLFormCollection::HTMLFormCollection):
* html/StepRange.cpp:
(WebCore::StepRange::StepRange):
* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::State::State):
* html/canvas/CanvasStyle.h:
(WebCore::CanvasStyle::CMYKAValues::CMYKAValues):
* html/canvas/WebGLGetInfo.cpp:
(WebCore::WebGLGetInfo::WebGLGetInfo):
* html/parser/CSSPreloadScanner.cpp:
(WebCore::CSSPreloadScanner::CSSPreloadScanner):
* html/track/WebVTTParser.cpp:
(WebCore::WebVTTParser::WebVTTParser):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@105457 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/fast/canvas/script-tests/canvas-webkitLineDash.js
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLFormCollection.cpp
Source/WebCore/html/StepRange.cpp
Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
Source/WebCore/html/canvas/CanvasStyle.h
Source/WebCore/html/canvas/WebGLGetInfo.cpp
Source/WebCore/html/parser/CSSPreloadScanner.cpp
Source/WebCore/html/track/WebVTTParser.cpp

index 41e71a6..c2d778a 100644 (file)
@@ -20,3 +20,9 @@ lineDash = ctx.webkitLineDash;
 shouldBe('lineDash[0]', '15');
 shouldBe('lineDash[1]', '10');
 shouldBe('ctx.webkitLineDashOffset', '5');
+
+// Verify that line dash offset persists after
+// clearRect (which causes a save/restore of the context
+// state to the stack).
+ctx.clearRect(0, 0, 700, 700);
+shouldBe('ctx.webkitLineDashOffset', '5');
index 1a5933b..d7c9146 100755 (executable)
@@ -1,3 +1,27 @@
+2012-01-19  Greg Billock  <gbillock@google.com>
+
+        [Coverity] Fix uninitialized constructor defects in .../html
+        https://bugs.webkit.org/show_bug.cgi?id=74965
+
+        Reviewed by Simon Fraser.
+
+        Test: fast/canvas/script-tests/canvas-webkitLineDash.js
+
+        * html/HTMLFormCollection.cpp:
+        (WebCore::HTMLFormCollection::HTMLFormCollection):
+        * html/StepRange.cpp:
+        (WebCore::StepRange::StepRange):
+        * html/canvas/CanvasRenderingContext2D.cpp:
+        (WebCore::CanvasRenderingContext2D::State::State):
+        * html/canvas/CanvasStyle.h:
+        (WebCore::CanvasStyle::CMYKAValues::CMYKAValues):
+        * html/canvas/WebGLGetInfo.cpp:
+        (WebCore::WebGLGetInfo::WebGLGetInfo):
+        * html/parser/CSSPreloadScanner.cpp:
+        (WebCore::CSSPreloadScanner::CSSPreloadScanner):
+        * html/track/WebVTTParser.cpp:
+        (WebCore::WebVTTParser::WebVTTParser):
+
 2012-01-19  Alexandru Chiculita  <achicu@adobe.com>
 
         CSS Shaders: Remove the setTimeout from the layout tests
index d25653f..919e09c 100644 (file)
@@ -37,6 +37,7 @@ using namespace HTMLNames;
 
 HTMLFormCollection::HTMLFormCollection(HTMLFormElement* form)
     : HTMLCollection(form, OtherCollection)
+    , currentPos(0)
 {
 }
 
index 68b0ebd..7948020 100644 (file)
@@ -35,10 +35,10 @@ using namespace HTMLNames;
 
 StepRange::StepRange(const HTMLInputElement* element)
 {
-    if (element->hasAttribute(precisionAttr)) {
-        step = 1.0;
+    step = 1;
+    if (element->hasAttribute(precisionAttr))
         hasStep = !equalIgnoringCase(element->getAttribute(precisionAttr), "float");
-    else
+    else
         hasStep = element->getAllowedValueStep(&step);
 
     maximum = element->maximum();
index 948c219..c4647e7 100644 (file)
@@ -219,6 +219,7 @@ CanvasRenderingContext2D::State::State(const State& other)
     , m_globalComposite(other.m_globalComposite)
     , m_transform(other.m_transform)
     , m_invertibleCTM(other.m_invertibleCTM)
+    , m_lineDashOffset(other.m_lineDashOffset)
     , m_textAlign(other.m_textAlign)
     , m_textBaseline(other.m_textBaseline)
     , m_unparsedFont(other.m_unparsedFont)
index 8f4bfd4..431fb28 100644 (file)
@@ -88,8 +88,8 @@ namespace WebCore {
         RefPtr<CanvasPattern> m_pattern;
 
         struct CMYKAValues {
-            CMYKAValues() {}
-            CMYKAValues(float cyan, float magenta, float yellow, float black, float alpha) : c(cyan), m(magenta), y(yellow), k(black), a(alpha) {}
+            CMYKAValues() : c(0), m(0), y(0), k(0), a(0) { }
+            CMYKAValues(float cyan, float magenta, float yellow, float black, float alpha) : c(cyan), m(magenta), y(yellow), k(black), a(alpha) { }
             float c;
             float m;
             float y;
index bce3836..87bec79 100644 (file)
@@ -45,11 +45,18 @@ namespace WebCore {
 WebGLGetInfo::WebGLGetInfo(bool value)
     : m_type(kTypeBool)
     , m_bool(value)
+    , m_float(0)
+    , m_int(0)
+    , m_unsignedInt(0)
 {
 }
 
 WebGLGetInfo::WebGLGetInfo(const bool* value, int size)
     : m_type(kTypeBoolArray)
+    , m_bool(false)
+    , m_float(0)
+    , m_int(0)
+    , m_unsignedInt(0)
 {
     if (!value || size <=0)
         return;
@@ -60,83 +67,136 @@ WebGLGetInfo::WebGLGetInfo(const bool* value, int size)
 
 WebGLGetInfo::WebGLGetInfo(float value)
     : m_type(kTypeFloat)
+    , m_bool(false)
     , m_float(value)
+    , m_int(0)
+    , m_unsignedInt(0)
 {
 }
 
 WebGLGetInfo::WebGLGetInfo(int value)
     : m_type(kTypeInt)
+    , m_bool(false)
+    , m_float(0)
     , m_int(value)
+    , m_unsignedInt(0)
 {
 }
 
 WebGLGetInfo::WebGLGetInfo()
     : m_type(kTypeNull)
+    , m_bool(false)
+    , m_float(0)
+    , m_int(0)
+    , m_unsignedInt(0)
 {
 }
 
 WebGLGetInfo::WebGLGetInfo(const String& value)
     : m_type(kTypeString)
+    , m_bool(false)
+    , m_float(0)
+    , m_int(0)
     , m_string(value)
+    , m_unsignedInt(0)
 {
 }
 
 WebGLGetInfo::WebGLGetInfo(unsigned int value)
     : m_type(kTypeUnsignedInt)
+    , m_bool(false)
+    , m_float(0)
+    , m_int(0)
     , m_unsignedInt(value)
 {
 }
 
 WebGLGetInfo::WebGLGetInfo(PassRefPtr<WebGLBuffer> value)
     : m_type(kTypeWebGLBuffer)
+    , m_bool(false)
+    , m_float(0)
+    , m_int(0)
+    , m_unsignedInt(0)
     , m_webglBuffer(value)
 {
 }
 
 WebGLGetInfo::WebGLGetInfo(PassRefPtr<Float32Array> value)
     : m_type(kTypeWebGLFloatArray)
+    , m_bool(false)
+    , m_float(0)
+    , m_int(0)
+    , m_unsignedInt(0)
     , m_webglFloatArray(value)
 {
 }
 
 WebGLGetInfo::WebGLGetInfo(PassRefPtr<WebGLFramebuffer> value)
     : m_type(kTypeWebGLFramebuffer)
+    , m_bool(false)
+    , m_float(0)
+    , m_int(0)
+    , m_unsignedInt(0)
     , m_webglFramebuffer(value)
 {
 }
 
 WebGLGetInfo::WebGLGetInfo(PassRefPtr<Int32Array> value)
     : m_type(kTypeWebGLIntArray)
+    , m_bool(false)
+    , m_float(0)
+    , m_int(0)
+    , m_unsignedInt(0)
     , m_webglIntArray(value)
 {
 }
 
 WebGLGetInfo::WebGLGetInfo(PassRefPtr<WebGLProgram> value)
     : m_type(kTypeWebGLProgram)
+    , m_bool(false)
+    , m_float(0)
+    , m_int(0)
+    , m_unsignedInt(0)
     , m_webglProgram(value)
 {
 }
 
 WebGLGetInfo::WebGLGetInfo(PassRefPtr<WebGLRenderbuffer> value)
     : m_type(kTypeWebGLRenderbuffer)
+    , m_bool(false)
+    , m_float(0)
+    , m_int(0)
+    , m_unsignedInt(0)
     , m_webglRenderbuffer(value)
 {
 }
 
 WebGLGetInfo::WebGLGetInfo(PassRefPtr<WebGLTexture> value)
     : m_type(kTypeWebGLTexture)
+    , m_bool(false)
+    , m_float(0)
+    , m_int(0)
+    , m_unsignedInt(0)
     , m_webglTexture(value)
 {
 }
 
 WebGLGetInfo::WebGLGetInfo(PassRefPtr<Uint8Array> value)
     : m_type(kTypeWebGLUnsignedByteArray)
+    , m_bool(false)
+    , m_float(0)
+    , m_int(0)
+    , m_unsignedInt(0)
     , m_webglUnsignedByteArray(value)
 {
 }
 
 WebGLGetInfo::WebGLGetInfo(PassRefPtr<WebGLVertexArrayObjectOES> value)
     : m_type(kTypeWebGLVertexArrayObjectOES)
+    , m_bool(false)
+    , m_float(0)
+    , m_int(0)
+    , m_unsignedInt(0)
     , m_webglVertexArrayObject(value)
 {
 }
index f91190d..29f1ccd 100644 (file)
@@ -38,6 +38,7 @@ namespace WebCore {
 
 CSSPreloadScanner::CSSPreloadScanner(Document* document)
     : m_state(Initial)
+    , m_scanningBody(false)
     , m_document(document)
 {
 }
index 114978f..050fb27 100644 (file)
@@ -109,6 +109,8 @@ String WebVTTParser::collectWord(const String& input, unsigned* position)
 WebVTTParser::WebVTTParser(WebVTTParserClient* client, ScriptExecutionContext* context)
     : m_scriptExecutionContext(context)
     , m_state(Initial)
+    , m_currentStartTime(0)
+    , m_currentEndTime(0)
     , m_tokenizer(WebVTTTokenizer::create())
     , m_client(client)
 {