Skip to content

Commit

Permalink
Fix DevicePathToDriveLetterPath when more than one mapping
Browse files Browse the repository at this point in the history
In https://crrev.com/c/5604926 we changed DevicePathToDriveLetterPath
to use a wstring_view over the mappings, which are a series of
nul-teminated strings followed by an empty string at the end. The loop
exits when it finds an empty string.

However at the bottom of the loop, instead of moving to the start of
the next nul-terminated string, we searched for the nul and moved to
it, so the second mapping would never be reached.

For whatever reason the windows rust bots happen to hit this case
and were failing tests as a result, so they are added to the set
of bots in the CQ for this CL.

Change-Id: I87874f3b332fcb291360c1b2bcbf57b287f13a2e
Cq-Include-Trybots: luci.chromium.try:win-rust-x64-dbg,win-rust-x64-rel
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5605635
Reviewed-by: Łukasz Anforowicz <[email protected]>
Commit-Queue: danakj <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1312171}
  • Loading branch information
danakj authored and Chromium LUCI CQ committed Jun 7, 2024
1 parent b9eba17 commit be8d8d1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion base/files/file_util_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,7 @@ bool DevicePathToDriveLetterPath(const FilePath& nt_device_path,
// increment after the '\0' that terminates the current string.
size_t idx = drive_mapping.find(L'\0');
CHECK(idx != std::wstring_view::npos);
drive_mapping = drive_mapping.substr(idx);
drive_mapping = drive_mapping.substr(idx + 1u);
}

// No drive matched. The path does not start with a device junction
Expand Down

0 comments on commit be8d8d1

Please sign in to comment.