Fixing SVACE Issues 96/308896/5
authorNikhil Shingne <n.shingne@samsung.com>
Tue, 2 Apr 2024 10:35:41 +0000 (16:05 +0530)
committerBot Blink <blinkbot@samsung.com>
Wed, 3 Apr 2024 17:45:12 +0000 (17:45 +0000)
This patch fixes the following type of issues:
1) DEREF_OF_NULL
2) missed return statement
3) unnecessary performance loss while passing by value
4) uninitialized data
5) string object was destroyed
6) class member not initialize

Change-Id: I64d15890d3a5cd9f16ae676c460e8713ed9759e2
Signed-off-by: Nikhil Shingne <n.shingne@samsung.com>
16 files changed:
tizen_src/chromium_impl/components/xwalk_extensions/browser/xwalk_extension.cc
tizen_src/chromium_impl/content/browser/context_menu/context_menu_controller_base.cc
tizen_src/chromium_impl/ui/ozone/platform/efl/efl_window.cc
tizen_src/chromium_impl/ui/ozone/platform/efl/efl_window.h
tizen_src/ewk/efl_integration/browser/render_message_filter_efl.cc
tizen_src/ewk/efl_integration/browser/render_message_filter_efl.h
tizen_src/ewk/efl_integration/browser/ssl_host_state_delegate_efl.cc
tizen_src/ewk/efl_integration/browser/ssl_host_state_delegate_efl.h
tizen_src/ewk/efl_integration/renderer/gin_native_function_invocation_helper.cc
tizen_src/ewk/efl_integration/renderer/plugins/plugin_placeholder_hole.cc
tizen_src/ewk/ubrowser/main.cc
wrt/src/browser/wrt_render_message_filter.cc
wrt/src/browser/wrt_render_message_filter.h
wrt/src/browser/wrt_web_contents.cc
wrt/src/browser/wrt_window_tree_host.cc
wrt/src/browser/wrt_window_tree_host.h

index 361b43d..b4df023 100644 (file)
@@ -168,7 +168,7 @@ class XWalkExtension::Interface {
   static const char* RuntimeGetMetadataValue(const char* key) {
     auto* extension_manager = XWalkExtensionManager::GetInstance();
     auto value = extension_manager->GetMetadataValue(key);
-    return value.c_str();
+    return strdup(value.c_str());
   }
 
   static int PermissionsCheckAPIAccessControl(
index 0fdf255..02d9ec4 100644 (file)
@@ -292,8 +292,9 @@ void ContextMenuControllerBase::ContextMenuItemSelectedCallback(
 }
 
 void ContextMenuControllerBase::RequestSelectionRect() const {
-  CHECK(rwhva());
-  rwhva()->host()->RequestSelectionRect();
+  if (rwhva()) {
+    rwhva()->host()->RequestSelectionRect();
+  }
 }
 
 gfx::Point ContextMenuControllerBase::CalculateSelectionMenuPosition(
index 4e96bc0..b24cff0 100644 (file)
@@ -83,7 +83,7 @@ void EflWindow::SetPreparedEvasObject(Ecore_Evas* ee) {
 }
 
 EflWindow::EflWindow(PlatformWindowDelegate* delegate,
-                     PlatformWindowInitProperties properties,
+                     const PlatformWindowInitProperties& properties,
                      EflWindowManager* manager)
     : delegate_(delegate), window_manager_(manager) {
   LOG(INFO) << this;
index 1e99f25..476367b 100644 (file)
@@ -29,7 +29,7 @@ class EflWindow : public PlatformWindow, public PlatformEventDispatcher {
   static void SetPreparedEvasObject(Ecore_Evas* ee);
 
   EflWindow(PlatformWindowDelegate* delegate,
-            PlatformWindowInitProperties properties,
+            const PlatformWindowInitProperties& properties,
             EflWindowManager* manager);
 
   EflWindow(const EflWindow&) = delete;
index f74d5bf..139db68 100644 (file)
@@ -48,7 +48,8 @@ bool RenderMessageFilterEfl::OnMessageReceived(const IPC::Message& message) {
 }
 
 void RenderMessageFilterEfl::OnDecideNavigationPolicy(
-    NavigationPolicyParams params, bool* handled) {
+    const NavigationPolicyParams& params,
+    bool* handled) {
   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
 
   if (content::WebContents* web_contents =
index 27d1f0f..75ae5af 100644 (file)
@@ -32,7 +32,7 @@ class RenderMessageFilterEfl : public content::BrowserMessageFilter {
       content::BrowserThread::ID*) override;
 
  private:
-  void OnDecideNavigationPolicy(NavigationPolicyParams, bool* handled);
+  void OnDecideNavigationPolicy(const NavigationPolicyParams&, bool* handled);
   void OnReceivedHitTestData(int view, const _Ewk_Hit_Test& hit_test_data,
       const NodeAttributesMap& node_attributes);
 
index 9526940..d660c83 100644 (file)
@@ -118,4 +118,9 @@ bool SSLHostStateDelegateEfl::HasAllowException(
     StoragePartition* storage_partition) {
   return false;
 }
+
+bool SSLHostStateDelegateEfl::HasAllowExceptionForAnyHost(
+    StoragePartition* storage_partition) {
+  return false;
+}
 }
index a13dd5d..22b1fef 100644 (file)
@@ -100,7 +100,7 @@ class SSLHostStateDelegateEfl : public SSLHostStateDelegate {
                          StoragePartition* storage_partition) override;
 
   bool HasAllowExceptionForAnyHost(
-      StoragePartition* storage_partition) override {}
+      StoragePartition* storage_partition) override;
 
  private:
   // Certificate policies for each host.
index 8906fdd..f61efb5 100644 (file)
@@ -68,7 +68,7 @@ v8::Local<v8::Value> GinNativeFunctionInvocationHelper::Invoke(
     }
   }
 
-  GinNativeBridgeError error;
+  GinNativeBridgeError error = kGinNativeBridgeNoError;
   std::unique_ptr<base::Value> result = dispatcher_->InvokeNativeMethod(
       object->object_id(), method_name_, arguments, &error);
   if (!result.get()) {
index a13d00e..f588e83 100644 (file)
@@ -149,7 +149,9 @@ PluginPlaceholderHole::PluginPlaceholderHole(
   hole_layer_->SetBackgroundColor(SkColor4f::FromColor(SK_ColorTRANSPARENT));
   hole_layer_->SetContentsOpaque(true);
   hole_layer_->SetContentsOpaqueFixed(true);
-  plugin()->SetCcLayer(hole_layer_.get());
+  if (plugin()) {
+    plugin()->SetCcLayer(hole_layer_.get());
+  }
 }
 
 PluginPlaceholderHole::~PluginPlaceholderHole() {
index f26eb3c..d5d9ce9 100644 (file)
@@ -52,7 +52,10 @@ const unsigned int kWaitTimeout = 5000;
 #endif
 
 struct AppData {
-  AppData() : browser(nullptr), ewk_initialized(false) { }
+  AppData()
+      : browser(nullptr),
+        browser_autostart_webinspector(false),
+        ewk_initialized(false) {}
 
   std::vector<std::string> urls;
   Browser* browser;
index bfd8ab8..73b0d48 100644 (file)
@@ -44,7 +44,7 @@ bool WRTRenderMessageFilter::OnMessageReceived(const IPC::Message& message) {
 }
 
 void WRTRenderMessageFilter::OnDecideNavigationPolicy(
-    NavigationPolicyParams params,
+    const NavigationPolicyParams& params,
     bool* handled) {
   DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
 
index 638f374..0409f54 100644 (file)
@@ -24,7 +24,7 @@ class WRTRenderMessageFilter : public content::BrowserMessageFilter {
                                 content::BrowserThread::ID*) override;
 
  private:
-  void OnDecideNavigationPolicy(NavigationPolicyParams, bool* handled);
+  void OnDecideNavigationPolicy(const NavigationPolicyParams&, bool* handled);
 };
 
 } // namespace wrt
index 0486b09..8b6ecbf 100644 (file)
@@ -346,10 +346,9 @@ void WRTWebContents::ShowContextMenuInternal(
     auto* renderer = GetRendererInterface();
     if (!renderer)
       return;
-    renderer->QueryInputType(
-        base::BindOnce([](content::WebContents* web_contents,
-                          content::ContextMenuParams params,
-                          bool is_password_input) -> void {
+    renderer->QueryInputType(base::BindOnce(
+        [](content::WebContents* web_contents,
+           content::ContextMenuParams& params, bool is_password_input) -> void {
           auto* wrt_web_contents =
               WRTWebContents::FromWebContents(web_contents);
           if (!wrt_web_contents)
@@ -360,7 +359,8 @@ void WRTWebContents::ShowContextMenuInternal(
                 blink::mojom::FormControlType::kInputPassword;
           }
           wrt_web_contents->UpdateContextMenuWithParams(params);
-        }, web_contents(), params));
+        },
+        web_contents(), base::OwnedRef(params)));
   } else {
     UpdateContextMenuWithParams(params);
   }
index c5455ea..cda5975 100644 (file)
@@ -35,7 +35,7 @@ const struct tizen_policy_listener policy_listener = {
 }  // namespace
 
 WRTWindowTreeHost::WRTWindowTreeHost(
-    ui::PlatformWindowInitProperties properties,
+    ui::PlatformWindowInitProperties&& properties,
     std::unique_ptr<aura::Window> window)
     : aura::WindowTreeHostPlatform(std::move(properties), std::move(window)) {
 #if defined(USE_WAYLAND)
index 0afaafe..cb135c5 100644 (file)
@@ -33,7 +33,7 @@ class WRTWindowTreeHost : public aura::WindowTreeHostPlatform,
   bool is_active() const { return is_active_; }
 
  private:
-  WRTWindowTreeHost(ui::PlatformWindowInitProperties properties,
+  WRTWindowTreeHost(ui::PlatformWindowInitProperties&& properties,
                     std::unique_ptr<aura::Window> window);
 
   // ui::PlatformWindowDelegate: