diff options
author | Aleksandr Platonov <platonov.aleksandr@huawei.com> | 2020-08-26 22:10:35 +0300 |
---|---|---|
committer | Aleksandr Platonov <platonov.aleksandr@huawei.com> | 2020-08-26 22:11:44 +0300 |
commit | ceffd6993c350b57f43cec3b6371b159fc4a3149 (patch) | |
tree | f54b9e20434c81167e639d859bd958f51be282d3 /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | 28fbf422f248fc74681a53208aa2f543a67515ac (diff) | |
download | llvm-ceffd6993c350b57f43cec3b6371b159fc4a3149.zip llvm-ceffd6993c350b57f43cec3b6371b159fc4a3149.tar.gz llvm-ceffd6993c350b57f43cec3b6371b159fc4a3149.tar.bz2 |
[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
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions