[PATCH] D83321: [Support] Fix utf16 path's index upper bound

Ding Fei via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 7 09:38:21 PDT 2020


danix800 created this revision.
danix800 added reviewers: ddunbar, lattner, krememek.
Herald added subscribers: llvm-commits, Charusso, arphaman, dexonsmith, hiraditya.
Herald added a project: LLVM.

Size of paths in utf8 is possibly bigger than in utf16.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D83321

Files:
  llvm/lib/Support/Windows/Path.inc


Index: llvm/lib/Support/Windows/Path.inc
===================================================================
--- llvm/lib/Support/Windows/Path.inc
+++ llvm/lib/Support/Windows/Path.inc
@@ -958,8 +958,8 @@
 
   // Convert path to the format that Windows is happy with.
   if (PathUTF16.size() > 0 &&
-      !is_separator(PathUTF16[Path.size() - 1]) &&
-      PathUTF16[Path.size() - 1] != L':') {
+      !is_separator(PathUTF16[PathUTF16.size() - 1]) &&
+      PathUTF16[PathUTF16.size() - 1] != L':') {
     PathUTF16.push_back(L'\\');
     PathUTF16.push_back(L'*');
   } else {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83321.276103.patch
Type: text/x-patch
Size: 580 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200707/7ec1c009/attachment.bin>


More information about the llvm-commits mailing list