Title: [123202] trunk/Source/WebKit/efl
Revision
123202
Author
[email protected]
Date
2012-07-20 04:26:48 -0700 (Fri, 20 Jul 2012)

Log Message

[EFL] Check parameters of ewk APIs in ewk_security_origin
https://bugs.webkit.org/show_bug.cgi?id=91833

Patch by Kihong Kwon <[email protected]> on 2012-07-20
Reviewed by Kentaro Hara.

For preventing crash, check parameters of ewk APIs in the ewk_security_origin.cpp.

* ewk/ewk_security_origin.cpp:
(ewk_security_origin_port_get):
(ewk_security_origin_web_database_usage_get):
(ewk_security_origin_web_database_quota_get):
(ewk_security_origin_web_database_quota_set):
(ewk_security_origin_application_cache_quota_set):
(ewk_security_origin_application_cache_clear):
(ewk_security_origin_web_database_get_all):
(ewk_security_origin_free):
* ewk/ewk_security_origin.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit/efl/ChangeLog (123201 => 123202)


--- trunk/Source/WebKit/efl/ChangeLog	2012-07-20 11:25:08 UTC (rev 123201)
+++ trunk/Source/WebKit/efl/ChangeLog	2012-07-20 11:26:48 UTC (rev 123202)
@@ -1,3 +1,23 @@
+2012-07-20  Kihong Kwon  <[email protected]>
+
+        [EFL] Check parameters of ewk APIs in ewk_security_origin
+        https://bugs.webkit.org/show_bug.cgi?id=91833
+
+        Reviewed by Kentaro Hara.
+
+        For preventing crash, check parameters of ewk APIs in the ewk_security_origin.cpp.
+
+        * ewk/ewk_security_origin.cpp:
+        (ewk_security_origin_port_get):
+        (ewk_security_origin_web_database_usage_get):
+        (ewk_security_origin_web_database_quota_get):
+        (ewk_security_origin_web_database_quota_set):
+        (ewk_security_origin_application_cache_quota_set):
+        (ewk_security_origin_application_cache_clear):
+        (ewk_security_origin_web_database_get_all):
+        (ewk_security_origin_free):
+        * ewk/ewk_security_origin.h:
+
 2012-07-19  Kihong Kwon  <[email protected]>
 
         [EFL] Enable interactive form validation

Modified: trunk/Source/WebKit/efl/ewk/ewk_security_origin.cpp (123201 => 123202)


--- trunk/Source/WebKit/efl/ewk/ewk_security_origin.cpp	2012-07-20 11:25:08 UTC (rev 123201)
+++ trunk/Source/WebKit/efl/ewk/ewk_security_origin.cpp	2012-07-20 11:26:48 UTC (rev 123202)
@@ -60,11 +60,14 @@
 
 uint32_t ewk_security_origin_port_get(const Ewk_Security_Origin* origin)
 {
+    EINA_SAFETY_ON_NULL_RETURN_VAL(origin, 0);
     return origin->securityOrigin->port();
 }
 
 uint64_t ewk_security_origin_web_database_usage_get(const Ewk_Security_Origin* origin)
 {
+    EINA_SAFETY_ON_NULL_RETURN_VAL(origin, 0);
+
 #if ENABLE(SQL_DATABASE)
     return WebCore::DatabaseTracker::tracker().usageForOrigin(origin->securityOrigin.get());
 #else
@@ -74,6 +77,8 @@
 
 uint64_t ewk_security_origin_web_database_quota_get(const Ewk_Security_Origin* origin)
 {
+    EINA_SAFETY_ON_NULL_RETURN_VAL(origin, 0);
+
 #if ENABLE(SQL_DATABASE)
     return WebCore::DatabaseTracker::tracker().quotaForOrigin(origin->securityOrigin.get());
 #else
@@ -83,6 +88,8 @@
 
 void ewk_security_origin_web_database_quota_set(const Ewk_Security_Origin* origin, uint64_t quota)
 {
+    EINA_SAFETY_ON_NULL_RETURN(origin);
+
 #if ENABLE(SQL_DATABASE)
     WebCore::DatabaseTracker::tracker().setQuota(origin->securityOrigin.get(), quota);
 #endif
@@ -90,16 +97,20 @@
 
 void ewk_security_origin_application_cache_quota_set(const Ewk_Security_Origin* origin, int64_t quota)
 {
+    EINA_SAFETY_ON_NULL_RETURN(origin);
     WebCore::cacheStorage().storeUpdatedQuotaForOrigin(origin->securityOrigin.get(), quota);
 }
 
 void ewk_security_origin_application_cache_clear(const Ewk_Security_Origin* origin)
 {
+    EINA_SAFETY_ON_NULL_RETURN(origin);
     WebCore::ApplicationCache::deleteCacheForOrigin(origin->securityOrigin.get());
 }
 
 Eina_List* ewk_security_origin_web_database_get_all(const Ewk_Security_Origin* origin)
 {
+    EINA_SAFETY_ON_NULL_RETURN_VAL(origin, 0);
+
     Eina_List* databases = 0;
 #if ENABLE(SQL_DATABASE)
     Vector<WTF::String> names;
@@ -119,6 +130,8 @@
 
 void ewk_security_origin_free(Ewk_Security_Origin* origin)
 {
+    EINA_SAFETY_ON_NULL_RETURN(origin);
+
     origin->securityOrigin = 0;
     eina_stringshare_del(origin->host);
     eina_stringshare_del(origin->protocol);

Modified: trunk/Source/WebKit/efl/ewk/ewk_security_origin.h (123201 => 123202)


--- trunk/Source/WebKit/efl/ewk/ewk_security_origin.h	2012-07-20 11:25:08 UTC (rev 123201)
+++ trunk/Source/WebKit/efl/ewk/ewk_security_origin.h	2012-07-20 11:26:48 UTC (rev 123202)
@@ -81,7 +81,7 @@
  *
  * @param o security origin object
  *
- * @return the port
+ * @return the port or @c 0 if there is not a proper security origin scheme
  */
 EAPI uint32_t             ewk_security_origin_port_get(const Ewk_Security_Origin *o);
 
@@ -91,7 +91,7 @@
  * This function won't work if Web SQL Database was not enabled when
  * building WebKit and will just return 0.
  *
- * @param o security origin object
+ * @param o security origin object or @c 0 if there is not a proper security origin scheme
  *
  * @return the usage in bytes
  */
@@ -105,7 +105,7 @@
  *
  * @param o security origin object
  *
- * @return the quota in bytes
+ * @return the quota in bytes or @c 0 if there is not a proper security origin scheme
  */
 EAPI uint64_t             ewk_security_origin_web_database_quota_get(const Ewk_Security_Origin *o);
 
@@ -146,7 +146,7 @@
  *
  * @param o security origin object
  *
- * @return list of web databases in the security origin
+ * @return list of web databases in the security origin or @c NULL if there is not a proper security origin scheme
  *
  * @see ewk_web_database_free()
  * @see ewk_web_database_list_free()
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to