Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: fb88913b6d7faf2a5301b5c6994a6e3d8b028925
https://github.com/WebKit/WebKit/commit/fb88913b6d7faf2a5301b5c6994a6e3d8b028925
Author: Chris Dumez <[email protected]>
Date: 2026-03-30 (Mon, 30 Mar 2026)
Changed paths:
M Source/WTF/wtf/FileSystem.cpp
M Tools/TestWebKitAPI/Tests/WTF/FileSystem.cpp
Log Message:
-----------
FileSystem::isAncestor should check path separator boundary
https://bugs.webkit.org/show_bug.cgi?id=311073
Reviewed by Ryosuke Niwa.
`isAncestor("/a/b/c", "/a/b/cd")` incorrectly returns true because
it only checks that the child path starts with the ancestor string,
without verifying the match ends at a path separator boundary.
This could cause `moveFile()` to incorrectly refuse valid moves when
the destination path shares a prefix with the source.
Fix by additionally checking that the character after the ancestor
prefix in the child path is a path separator.
Test: Tools/TestWebKitAPI/Tests/WTF/FileSystem.cpp
* Source/WTF/wtf/FileSystem.cpp:
(WTF::FileSystemImpl::isAncestor):
* Tools/TestWebKitAPI/Tests/WTF/FileSystem.cpp:
(TestWebKitAPI::TEST_F(FileSystemTest, isAncestor)):
Canonical link: https://commits.webkit.org/310269@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications