1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00
llvm-mirror/lib/Support/Windows
Aleksandr Platonov 218a7995fe [Support][Windows] Fix incorrect GetFinalPathNameByHandleW() return value check in realPathFromHandle()
`GetFinalPathNameByHandleW(,,N,)` returns:
- `< N` on success (this value does not include the size of the terminating null character)
- `>= N` if buffer is too small (this value includes the size of the terminating null character)

So, when `N == Buffer.capacity() - 1`, we need to resize buffer if return value is > `Buffer.capacity() - 2`.
Also, we can set `N` to `Buffer.capacity()`.

Thus, without this patch `realPathFromHandle()` returns unfilled buffer when length of the final path of the file is equal to `Buffer.capacity()` or `Buffer.capacity() - 1`.

Reviewed By: andrewng, amccarth

Differential Revision: https://reviews.llvm.org/D86564
2020-08-26 22:11:44 +03:00
..
COM.inc
DynamicLibrary.inc
explicit_symbols.inc
Host.inc
Memory.inc
Path.inc [Support][Windows] Fix incorrect GetFinalPathNameByHandleW() return value check in realPathFromHandle() 2020-08-26 22:11:44 +03:00
Process.inc
Program.inc [Windows] Fix limit on command line size 2020-07-23 11:39:42 +07:00
Signals.inc [Support] Allow printing the stack trace only for a given depth 2020-08-26 09:27:42 -04:00
Threading.inc
ThreadLocal.inc
Watchdog.inc