[Support] Fix Windows directory_iterator_construct out of bounds
authorAndrew Ng <andrew.ng@sony.com>
Mon, 13 Jul 2020 12:36:33 +0000 (13:36 +0100)
committerAndrew Ng <andrew.ng@sony.com>
Wed, 15 Jul 2020 09:13:45 +0000 (10:13 +0100)
commitf6eb5daa16368fb90d5a59b14a72bfd8ddbcd2a0
tree609922885c5f656c76fa3bff029057669021d2e7
parentf782d9c7002edaaf56c06a6cc1775f8f67713a29
[Support] Fix Windows directory_iterator_construct out of bounds

Fix incorrect use of the size of Path when accessing PathUTF16, as the
UTF-16 path can be shorter. Added unit test for coverage of this test
case.

Thanks to Ding Fei (danix800) for the code fix, see
https://reviews.llvm.org/D83321.

Differential Revision: https://reviews.llvm.org/D83689
llvm/lib/Support/Windows/Path.inc
llvm/unittests/Support/Path.cpp