1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00

Fix after r315079

Microsoft's debug implementation of std::copy checks if the destination is an
array and then does some bounds checking.  This was causing an assertion
failure in fs::rename_internal which copies to a buffer of the appropriate
size but that's type-punned to an array of length 1 for API compatibility
reasons.

Fix is to make make the destination a pointer rather than an array.

llvm-svn: 315222
This commit is contained in:
Adrian McCarthy 2017-10-09 17:50:01 +00:00
parent c869c90b7c
commit bc0e80ef8f

View File

@ -372,7 +372,7 @@ static std::error_code rename_internal(HANDLE FromHandle, const Twine &To,
RenameInfo.ReplaceIfExists = ReplaceIfExists;
RenameInfo.RootDirectory = 0;
RenameInfo.FileNameLength = ToWide.size();
std::copy(ToWide.begin(), ToWide.end(), RenameInfo.FileName);
std::copy(ToWide.begin(), ToWide.end(), &RenameInfo.FileName[0]);
if (!SetFileInformationByHandle(FromHandle, FileRenameInfo, &RenameInfo,
RenameInfoBuf.size()))