Title: [254683] trunk/Source
Revision
254683
Author
[email protected]
Date
2020-01-16 08:04:54 -0800 (Thu, 16 Jan 2020)

Log Message

Enable -Wconditional-uninitialized in WebInspectorUI, WebKitLegacy, WebKit projects
<https://webkit.org/b/206270>
<rdar://problem/58589767>

Reviewed by Tim Horton.

* Configurations/Base.xcconfig:
(WARNING_CFLAGS): Add -Wconditional-uninitialized switch.
Source/WebKit:

* UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::WebAutomationSession::performInteractionSequence):
Initialize `x`, `y` stack variables since the compiler can't
reason about the behavior of JSON::Object::getInteger().
* WebProcess/Plugins/PDF/PDFPlugin.mm:
(WebKit::getAllScriptsInPDFDocument): Initialize `length` stack
variable.  Also add check that `length` is non-zero.

Source/WebKitLegacy/mac:

* Plugins/WebNetscapePluginView.mm:
(-[WebNetscapePluginView scheduleTimerWithInterval:repeat:timerFunc:]):
Initialize `slot` stack variable.
* WebView/WebPDFDocumentExtras.mm:
(allScriptsInPDFDocument): Initialize `length` stack variable.
Also add check that `length` is non-zero.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (254682 => 254683)


--- trunk/Source/WebInspectorUI/ChangeLog	2020-01-16 15:57:34 UTC (rev 254682)
+++ trunk/Source/WebInspectorUI/ChangeLog	2020-01-16 16:04:54 UTC (rev 254683)
@@ -1,3 +1,14 @@
+2020-01-16  David Kilzer  <[email protected]>
+
+        Enable -Wconditional-uninitialized in WebInspectorUI, WebKitLegacy, WebKit projects
+        <https://webkit.org/b/206270>
+        <rdar://problem/58589767>
+
+        Reviewed by Tim Horton.
+
+        * Configurations/Base.xcconfig:
+        (WARNING_CFLAGS): Add -Wconditional-uninitialized switch.
+
 2020-01-15  Devin Rousso  <[email protected]>
 
         Web Inspector: collapsing a virtualized folder in a `WI.TreeOutline` doesn't updated the DOM

Modified: trunk/Source/WebInspectorUI/Configurations/Base.xcconfig (254682 => 254683)


--- trunk/Source/WebInspectorUI/Configurations/Base.xcconfig	2020-01-16 15:57:34 UTC (rev 254682)
+++ trunk/Source/WebInspectorUI/Configurations/Base.xcconfig	2020-01-16 16:04:54 UTC (rev 254683)
@@ -64,7 +64,7 @@
 GCC_WARN_UNINITIALIZED_AUTOS = YES
 GCC_WARN_UNUSED_FUNCTION = YES;
 GCC_WARN_UNUSED_VARIABLE = YES
-WARNING_CFLAGS = -Wall -W -Wcast-qual -Wchar-subscripts -Wformat-security -Wmissing-format-attribute -Wpointer-arith -Wwrite-strings -Wno-unused-parameter -Wexit-time-destructors;
+WARNING_CFLAGS = -Wall -W -Wcast-qual -Wchar-subscripts -Wconditional-uninitialized -Wformat-security -Wmissing-format-attribute -Wpointer-arith -Wwrite-strings -Wno-unused-parameter -Wexit-time-destructors;
 
 ENGINEERING_BUILD_DEFINES = $(ENGINEERING_BUILD_DEFINES_$(ENGINEERING_BUILD));
 ENGINEERING_BUILD_DEFINES_1 = ENGINEERING_BUILD=1;

Modified: trunk/Source/WebKit/ChangeLog (254682 => 254683)


--- trunk/Source/WebKit/ChangeLog	2020-01-16 15:57:34 UTC (rev 254682)
+++ trunk/Source/WebKit/ChangeLog	2020-01-16 16:04:54 UTC (rev 254683)
@@ -1,3 +1,21 @@
+2020-01-16  David Kilzer  <[email protected]>
+
+        Enable -Wconditional-uninitialized in WebInspectorUI, WebKitLegacy, WebKit projects
+        <https://webkit.org/b/206270>
+        <rdar://problem/58589767>
+
+        Reviewed by Tim Horton.
+
+        * Configurations/Base.xcconfig:
+        (WARNING_CFLAGS): Add -Wconditional-uninitialized switch.
+        * UIProcess/Automation/WebAutomationSession.cpp:
+        (WebKit::WebAutomationSession::performInteractionSequence):
+        Initialize `x`, `y` stack variables since the compiler can't
+        reason about the behavior of JSON::Object::getInteger().
+        * WebProcess/Plugins/PDF/PDFPlugin.mm:
+        (WebKit::getAllScriptsInPDFDocument): Initialize `length` stack
+        variable.  Also add check that `length` is non-zero.
+
 2020-01-16  Carlos Garcia Campos  <[email protected]>
 
         [GTK][WPE] Web process crash when IM tries to delete surrounding text

Modified: trunk/Source/WebKit/Configurations/Base.xcconfig (254682 => 254683)


--- trunk/Source/WebKit/Configurations/Base.xcconfig	2020-01-16 15:57:34 UTC (rev 254682)
+++ trunk/Source/WebKit/Configurations/Base.xcconfig	2020-01-16 16:04:54 UTC (rev 254683)
@@ -86,7 +86,7 @@
 GCC_WARN_UNUSED_VARIABLE = YES;
 OTHER_MIGFLAGS = -F$(BUILT_PRODUCTS_DIR);
 PREBINDING = NO;
-WARNING_CFLAGS = -Wall -Wextra -Wcast-qual -Wchar-subscripts -Wextra-tokens -Wformat-security -Winit-self -Wmissing-format-attribute -Wmissing-noreturn -Wno-unused-parameter -Wpacked -Wpointer-arith -Wredundant-decls -Wundef -Wwrite-strings -Wexit-time-destructors -Wglobal-constructors -Wtautological-compare -Wimplicit-fallthrough;
+WARNING_CFLAGS = -Wall -Wextra -Wcast-qual -Wchar-subscripts -Wconditional-uninitialized -Wextra-tokens -Wformat-security -Winit-self -Wmissing-format-attribute -Wmissing-noreturn -Wno-unused-parameter -Wpacked -Wpointer-arith -Wredundant-decls -Wundef -Wwrite-strings -Wexit-time-destructors -Wglobal-constructors -Wtautological-compare -Wimplicit-fallthrough;
 
 TARGET_MAC_OS_X_VERSION_MAJOR = $(TARGET_MAC_OS_X_VERSION_MAJOR$(MACOSX_DEPLOYMENT_TARGET:suffix:identifier));
 TARGET_MAC_OS_X_VERSION_MAJOR_13 = 101300;

Modified: trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp (254682 => 254683)


--- trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp	2020-01-16 15:57:34 UTC (rev 254682)
+++ trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp	2020-01-16 16:04:54 UTC (rev 254683)
@@ -1932,7 +1932,7 @@
 
             RefPtr<JSON::Object> locationObject;
             if (stateObject->getObject("location"_s, locationObject)) {
-                int x, y;
+                int x = 0, y = 0;
                 if (locationObject->getInteger("x"_s, x) && locationObject->getInteger("y"_s, y))
                     sourceState.location = WebCore::IntPoint(x, y);
             }

Modified: trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm (254682 => 254683)


--- trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm	2020-01-16 15:57:34 UTC (rev 254682)
+++ trunk/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm	2020-01-16 16:04:54 UTC (rev 254683)
@@ -532,8 +532,8 @@
         if (!CGPDFDictionaryGetName(_javascript_Action, "S", &actionType) || strcmp(actionType, "_javascript_"))
             continue;
 
-        const UInt8* bytes = 0;
-        CFIndex length;
+        const UInt8* bytes = nullptr;
+        CFIndex length = 0;
         CGPDFStreamRef stream;
         CGPDFStringRef string;
         RetainPtr<CFDataRef> data;
@@ -548,7 +548,7 @@
             bytes = CGPDFStringGetBytePtr(string);
             length = CGPDFStringGetLength(string);
         }
-        if (!bytes)
+        if (!bytes || !length)
             continue;
 
         CFStringEncoding encoding = (length > 1 && bytes[0] == 0xFE && bytes[1] == 0xFF) ? kCFStringEncodingUnicode : kCFStringEncodingUTF8;

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (254682 => 254683)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2020-01-16 15:57:34 UTC (rev 254682)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2020-01-16 16:04:54 UTC (rev 254683)
@@ -1,3 +1,20 @@
+2020-01-16  David Kilzer  <[email protected]>
+
+        Enable -Wconditional-uninitialized in WebInspectorUI, WebKitLegacy, WebKit projects
+        <https://webkit.org/b/206270>
+        <rdar://problem/58589767>
+
+        Reviewed by Tim Horton.
+
+        * Configurations/Base.xcconfig:
+        (WARNING_CFLAGS): Add -Wconditional-uninitialized switch.
+        * Plugins/WebNetscapePluginView.mm:
+        (-[WebNetscapePluginView scheduleTimerWithInterval:repeat:timerFunc:]):
+        Initialize `slot` stack variable.
+        * WebView/WebPDFDocumentExtras.mm:
+        (allScriptsInPDFDocument): Initialize `length` stack variable.
+        Also add check that `length` is non-zero.
+
 2020-01-16  Cathie Chen  <[email protected]>
 
         Mapping HTML attributes width/height to the default aspect ratio of <img>

Modified: trunk/Source/WebKitLegacy/mac/Configurations/Base.xcconfig (254682 => 254683)


--- trunk/Source/WebKitLegacy/mac/Configurations/Base.xcconfig	2020-01-16 15:57:34 UTC (rev 254682)
+++ trunk/Source/WebKitLegacy/mac/Configurations/Base.xcconfig	2020-01-16 16:04:54 UTC (rev 254683)
@@ -88,7 +88,7 @@
 OTHER_MIGFLAGS = -F$(BUILT_PRODUCTS_DIR);
 CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
 PREBINDING = NO;
-WARNING_CFLAGS = -Wall -Wextra -Wcast-qual -Wchar-subscripts -Wextra-tokens -Wformat-security -Winit-self -Wmissing-format-attribute -Wmissing-noreturn -Wno-unused-parameter -Wpacked -Wpointer-arith -Wredundant-decls -Wundef -Wwrite-strings -Wexit-time-destructors -Wglobal-constructors -Wtautological-compare -Wimplicit-fallthrough;
+WARNING_CFLAGS = -Wall -Wextra -Wcast-qual -Wchar-subscripts -Wconditional-uninitialized -Wextra-tokens -Wformat-security -Winit-self -Wmissing-format-attribute -Wmissing-noreturn -Wno-unused-parameter -Wpacked -Wpointer-arith -Wredundant-decls -Wundef -Wwrite-strings -Wexit-time-destructors -Wglobal-constructors -Wtautological-compare -Wimplicit-fallthrough;
 
 TARGET_MAC_OS_X_VERSION_MAJOR = $(TARGET_MAC_OS_X_VERSION_MAJOR$(MACOSX_DEPLOYMENT_TARGET:suffix:identifier));
 TARGET_MAC_OS_X_VERSION_MAJOR_13 = 101300;

Modified: trunk/Source/WebKitLegacy/mac/Plugins/WebNetscapePluginView.mm (254682 => 254683)


--- trunk/Source/WebKitLegacy/mac/Plugins/WebNetscapePluginView.mm	2020-01-16 15:57:34 UTC (rev 254682)
+++ trunk/Source/WebKitLegacy/mac/Plugins/WebNetscapePluginView.mm	2020-01-16 16:04:54 UTC (rev 254683)
@@ -1656,7 +1656,7 @@
     if (!timers)
         timers = makeUnique<HashMap<uint32_t, std::unique_ptr<PluginTimer>>>();
 
-    std::unique_ptr<PluginTimer>* slot;
+    std::unique_ptr<PluginTimer>* slot = nullptr;
     uint32_t timerID;
     do
         timerID = ++currentTimerID;

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebPDFDocumentExtras.mm (254682 => 254683)


--- trunk/Source/WebKitLegacy/mac/WebView/WebPDFDocumentExtras.mm	2020-01-16 15:57:34 UTC (rev 254682)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebPDFDocumentExtras.mm	2020-01-16 16:04:54 UTC (rev 254683)
@@ -99,8 +99,8 @@
         if (!CGPDFDictionaryGetName(_javascript_Action, "S", &actionType) || strcmp(actionType, "_javascript_"))
             continue;
 
-        const UInt8* bytes = 0;
-        CFIndex length;
+        const UInt8* bytes = nullptr;
+        CFIndex length = 0;
         CGPDFStreamRef stream;
         CGPDFStringRef string;
         RetainPtr<CFDataRef> data;
@@ -115,7 +115,7 @@
             bytes = CGPDFStringGetBytePtr(string);
             length = CGPDFStringGetLength(string);
         }
-        if (!bytes)
+        if (!bytes || !length)
             continue;
 
         NSStringEncoding encoding = (length > 1 && bytes[0] == 0xFE && bytes[1] == 0xFF) ? NSUnicodeStringEncoding : NSUTF8StringEncoding;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to