Title: [259449] trunk/Source
Revision
259449
Author
[email protected]
Date
2020-04-03 01:38:59 -0700 (Fri, 03 Apr 2020)

Log Message

FileSystem handle leaks in CurlCacheManager and NetworkCacheData when failed to open a file
https://bugs.webkit.org/show_bug.cgi?id=209949

Reviewed by Fujii Hironori.

A file handle of FileSystem is not closed when the file handle doesn't
return its status. The handle should be released before returning.

No new tests, no behavior change.

Source/WebCore:

* platform/network/curl/CurlCacheManager.cpp:
(WebCore::CurlCacheManager::loadIndex):

Source/WebKit:

* NetworkProcess/cache/NetworkCacheData.cpp:
(WebKit::NetworkCache::mapFile):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (259448 => 259449)


--- trunk/Source/WebCore/ChangeLog	2020-04-03 07:24:14 UTC (rev 259448)
+++ trunk/Source/WebCore/ChangeLog	2020-04-03 08:38:59 UTC (rev 259449)
@@ -1,3 +1,18 @@
+2020-04-03  Yousuke Kimoto  <[email protected]>
+
+        FileSystem handle leaks in CurlCacheManager and NetworkCacheData when failed to open a file
+        https://bugs.webkit.org/show_bug.cgi?id=209949
+
+        Reviewed by Fujii Hironori.
+
+        A file handle of FileSystem is not closed when the file handle doesn't
+        return its status. The handle should be released before returning.
+
+        No new tests, no behavior change.
+
+        * platform/network/curl/CurlCacheManager.cpp:
+        (WebCore::CurlCacheManager::loadIndex):
+
 2020-04-03  Peng Liu  <[email protected]>
 
         WebCore::HTMLMediaElement::mediaCanStart crashes

Modified: trunk/Source/WebCore/platform/network/curl/CurlCacheManager.cpp (259448 => 259449)


--- trunk/Source/WebCore/platform/network/curl/CurlCacheManager.cpp	2020-04-03 07:24:14 UTC (rev 259448)
+++ trunk/Source/WebCore/platform/network/curl/CurlCacheManager.cpp	2020-04-03 08:38:59 UTC (rev 259449)
@@ -112,6 +112,7 @@
     long long filesize = -1;
     if (!FileSystem::getFileSize(indexFilePath, filesize)) {
         LOG(Network, "Cache Error: Could not get file size of %s\n", indexFilePath.latin1().data());
+        FileSystem::closeFile(indexFile);
         return;
     }
 

Modified: trunk/Source/WebKit/ChangeLog (259448 => 259449)


--- trunk/Source/WebKit/ChangeLog	2020-04-03 07:24:14 UTC (rev 259448)
+++ trunk/Source/WebKit/ChangeLog	2020-04-03 08:38:59 UTC (rev 259449)
@@ -1,3 +1,18 @@
+2020-04-03  Yousuke Kimoto  <[email protected]>
+
+        FileSystem handle leaks in CurlCacheManager and NetworkCacheData when failed to open a file
+        https://bugs.webkit.org/show_bug.cgi?id=209949
+
+        Reviewed by Fujii Hironori.
+
+        A file handle of FileSystem is not closed when the file handle doesn't
+        return its status. The handle should be released before returning.
+
+        No new tests, no behavior change.
+
+        * NetworkProcess/cache/NetworkCacheData.cpp:
+        (WebKit::NetworkCache::mapFile):
+
 2020-04-03  Peng Liu  <[email protected]>
 
         WebCore::HTMLMediaElement::mediaCanStart crashes

Modified: trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheData.cpp (259448 => 259449)


--- trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheData.cpp	2020-04-03 07:24:14 UTC (rev 259448)
+++ trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheData.cpp	2020-04-03 08:38:59 UTC (rev 259449)
@@ -84,8 +84,10 @@
     if (!FileSystem::isHandleValid(file))
         return { };
     long long size;
-    if (!FileSystem::getFileSize(file, size))
+    if (!FileSystem::getFileSize(file, size)) {
+        FileSystem::closeFile(file);
         return { };
+    }
     return adoptAndMapFile(file, 0, size);
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to