Fix self-intersecting copy in UTF16ToWchar()

Broken at https://pdfium-review.googlesource.com/c/pdfium/+/12210
Apply a simple fix before converting to spans.

Change-Id: I78c822cade18b043c8973f39c4a9dacd30238486
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/52011
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fxcrt/cfx_seekablestreamproxy.cpp b/core/fxcrt/cfx_seekablestreamproxy.cpp
index 9f35cb0..5884bca 100644
--- a/core/fxcrt/cfx_seekablestreamproxy.cpp
+++ b/core/fxcrt/cfx_seekablestreamproxy.cpp
@@ -83,8 +83,10 @@
 
   uint16_t* pSrc = static_cast<uint16_t*>(pBuffer);
   wchar_t* pDst = static_cast<wchar_t*>(pBuffer);
-  for (size_t i = 0; i < iLength; i++)
-    pDst[i] = static_cast<wchar_t>(pSrc[i]);
+
+  // Peform self-intersecting copy in reverse order.
+  for (size_t i = iLength; i > 0; --i)
+    pDst[i - 1] = static_cast<wchar_t>(pSrc[i - 1]);
 }
 
 void SwapByteOrder(wchar_t* pStr, size_t iLength) {