Title: [290862] trunk
Revision
290862
Author
[email protected]
Date
2022-03-04 22:02:13 -0800 (Fri, 04 Mar 2022)

Log Message

Add null check for path in makeAllDirectories
https://bugs.webkit.org/show_bug.cgi?id=237477

Reviewed by Darin Adler.

Source/WTF:

* wtf/posix/FileSystemPOSIX.cpp:
(WTF::FileSystemImpl::makeAllDirectories):

Tools:

* TestWebKitAPI/Tests/WTF/FileSystem.cpp:
(TestWebKitAPI::TEST_F):

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (290861 => 290862)


--- trunk/Source/WTF/ChangeLog	2022-03-05 05:39:27 UTC (rev 290861)
+++ trunk/Source/WTF/ChangeLog	2022-03-05 06:02:13 UTC (rev 290862)
@@ -1,3 +1,13 @@
+2022-03-04  Sihui Liu  <[email protected]>
+
+        Add null check for path in makeAllDirectories
+        https://bugs.webkit.org/show_bug.cgi?id=237477
+
+        Reviewed by Darin Adler.
+
+        * wtf/posix/FileSystemPOSIX.cpp:
+        (WTF::FileSystemImpl::makeAllDirectories):
+
 2022-03-04  Myles C. Maxfield  <[email protected]>
 
         [iOS] Books ASSERTs upon opening a book with a debug build of WebKit

Modified: trunk/Source/WTF/wtf/posix/FileSystemPOSIX.cpp (290861 => 290862)


--- trunk/Source/WTF/wtf/posix/FileSystemPOSIX.cpp	2022-03-05 05:39:27 UTC (rev 290861)
+++ trunk/Source/WTF/wtf/posix/FileSystemPOSIX.cpp	2022-03-05 06:02:13 UTC (rev 290862)
@@ -270,6 +270,9 @@
 bool makeAllDirectories(const String& path)
 {
     auto fullPath = fileSystemRepresentation(path);
+    if (fullPath.isNull())
+        return false;
+
     if (!access(fullPath.data(), F_OK))
         return true;
 

Modified: trunk/Tools/ChangeLog (290861 => 290862)


--- trunk/Tools/ChangeLog	2022-03-05 05:39:27 UTC (rev 290861)
+++ trunk/Tools/ChangeLog	2022-03-05 06:02:13 UTC (rev 290862)
@@ -1,3 +1,13 @@
+2022-03-04  Sihui Liu  <[email protected]>
+
+        Add null check for path in makeAllDirectories
+        https://bugs.webkit.org/show_bug.cgi?id=237477
+
+        Reviewed by Darin Adler.
+
+        * TestWebKitAPI/Tests/WTF/FileSystem.cpp:
+        (TestWebKitAPI::TEST_F):
+
 2022-03-04  Myles C. Maxfield  <[email protected]>
 
         [iOS] Books ASSERTs upon opening a book with a debug build of WebKit

Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/FileSystem.cpp (290861 => 290862)


--- trunk/Tools/TestWebKitAPI/Tests/WTF/FileSystem.cpp	2022-03-05 05:39:27 UTC (rev 290861)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/FileSystem.cpp	2022-03-05 06:02:13 UTC (rev 290862)
@@ -485,6 +485,10 @@
     EXPECT_EQ(FileSystem::fileType(subFolderPath), FileSystem::FileType::Directory);
     EXPECT_TRUE(FileSystem::deleteNonEmptyDirectory(tempEmptyFolderPath()));
     EXPECT_FALSE(FileSystem::fileExists(subFolderPath));
+    String invalidFolderPath;
+    invalidFolderPath.append('\0');
+    invalidFolderPath.append('a');
+    EXPECT_FALSE(FileSystem::makeAllDirectories(invalidFolderPath));
 }
 
 TEST_F(FileSystemTest, volumeFreeSpace)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to