Branch: refs/heads/webkitglib/2.52
Home: https://github.com/WebKit/WebKit
Commit: 1774b8f8c84b23778a54917210f937651b1c76a2
https://github.com/WebKit/WebKit/commit/1774b8f8c84b23778a54917210f937651b1c76a2
Author: Chris Dumez <[email protected]>
Date: 2026-04-21 (Tue, 21 Apr 2026)
Changed paths:
M Source/WTF/wtf/FileSystem.cpp
M Tools/TestWebKitAPI/Tests/WTF/FileSystem.cpp
Log Message:
-----------
Cherry-pick 310269@main (fb88913b6d7f).
https://bugs.webkit.org/show_bug.cgi?id=311073
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
Canonical link: https://commits.webkit.org/305877.447@webkitglib/2.52
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications