Title: [95088] trunk/Source/WebKit/efl
Revision
95088
Author
[email protected]
Date
2011-09-14 06:52:30 -0700 (Wed, 14 Sep 2011)

Log Message

[EFL] Add NULL checks to ewk_window_features_new_from_core and ewk_view_window_create.
https://bugs.webkit.org/show_bug.cgi?id=64932

Patch by Grzegorz Czajkowski <[email protected]> on 2011-09-14
Reviewed by Eric Seidel.

It prevents the crash while allocating memory for the new window.

* ewk/ewk_view.cpp:
(ewk_view_window_create):
* ewk/ewk_window_features.cpp:
(ewk_window_features_new_from_core):

Modified Paths

Diff

Modified: trunk/Source/WebKit/efl/ChangeLog (95087 => 95088)


--- trunk/Source/WebKit/efl/ChangeLog	2011-09-14 13:41:42 UTC (rev 95087)
+++ trunk/Source/WebKit/efl/ChangeLog	2011-09-14 13:52:30 UTC (rev 95088)
@@ -1,3 +1,17 @@
+2011-09-14  Grzegorz Czajkowski  <[email protected]>
+
+        [EFL] Add NULL checks to ewk_window_features_new_from_core and ewk_view_window_create.
+        https://bugs.webkit.org/show_bug.cgi?id=64932
+
+        Reviewed by Eric Seidel.
+
+        It prevents the crash while allocating memory for the new window.
+
+        * ewk/ewk_view.cpp:
+        (ewk_view_window_create):
+        * ewk/ewk_window_features.cpp:
+        (ewk_window_features_new_from_core):
+
 2011-09-13  Raphael Kubo da Costa  <[email protected]>
 
         [EFL] Do not always return the cached frame name.

Modified: trunk/Source/WebKit/efl/ewk/ewk_view.cpp (95087 => 95088)


--- trunk/Source/WebKit/efl/ewk/ewk_view.cpp	2011-09-14 13:41:42 UTC (rev 95087)
+++ trunk/Source/WebKit/efl/ewk/ewk_view.cpp	2011-09-14 13:52:30 UTC (rev 95088)
@@ -2864,7 +2864,7 @@
  * NULL, it will be created a window with default features.
  *
  * @return New view, in case smart class implements the creation of new windows;
- * else, current view @param o.
+ * else, current view @param o or @c 0 on failure.
  *
  * @see ewk_window_features_ref().
  */
@@ -2876,6 +2876,9 @@
         return o;
 
     Ewk_Window_Features *window_features = ewk_window_features_new_from_core(coreFeatures);
+    if (!window_features)
+        return 0;
+
     Evas_Object* view = sd->api->window_create(sd, _javascript_, window_features);
     ewk_window_features_unref(window_features);
 

Modified: trunk/Source/WebKit/efl/ewk/ewk_window_features.cpp (95087 => 95088)


--- trunk/Source/WebKit/efl/ewk/ewk_window_features.cpp	2011-09-14 13:41:42 UTC (rev 95087)
+++ trunk/Source/WebKit/efl/ewk/ewk_window_features.cpp	2011-09-14 13:52:30 UTC (rev 95088)
@@ -105,11 +105,15 @@
  *
  * @param core if not @c 0 a new WebCore::WindowFeatures is allocated copying core features and
  * it is embedded inside the Ewk_Window_Features whose ref count is initialized, if core is @c 0 a new one is created with the default features.
- * @returns a new allocated the Ewk_Window_Features object
+ * @return a new allocated the Ewk_Window_Features object on sucess or @c 0 on failure
  */
 Ewk_Window_Features *ewk_window_features_new_from_core(const WebCore::WindowFeatures *core)
 {
     Ewk_Window_Features *window_features = static_cast<Ewk_Window_Features*>(malloc(sizeof(*window_features)));
+    if (!window_features) {
+        CRITICAL("Could not allocate Ewk_Window_Features.");
+        return 0;
+    }
 
     if (core)
         window_features->core = new WebCore::WindowFeatures(*core);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to