Apply pdfium_noshorten_config to fpdfdsk/pwl.

Apply checked casts to avoid converting some selections to size_t,
since selections are problematic in that the use -1 sentinels, etc.

Change-Id: I99f1042543ce2673e10edcef74d2698c04f157f2
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/90690
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/fpdfsdk/pwl/BUILD.gn b/fpdfsdk/pwl/BUILD.gn
index f8bae0f..f1586d3 100644
--- a/fpdfsdk/pwl/BUILD.gn
+++ b/fpdfsdk/pwl/BUILD.gn
@@ -36,7 +36,10 @@
     "ipwl_fillernotify.h",
     "ipwl_systemhandler.h",
   ]
-  configs += [ "../../:pdfium_strict_config" ]
+  configs += [
+    "../../:pdfium_strict_config",
+    "../../:pdfium_noshorten_config",
+  ]
   deps = [
     "../../:pdfium_public_headers",
     "../../constants",
diff --git a/fpdfsdk/pwl/cpwl_list_box.cpp b/fpdfsdk/pwl/cpwl_list_box.cpp
index 8b3eca4..5c65795 100644
--- a/fpdfsdk/pwl/cpwl_list_box.cpp
+++ b/fpdfsdk/pwl/cpwl_list_box.cpp
@@ -15,6 +15,7 @@
 #include "fpdfsdk/pwl/cpwl_scroll_bar.h"
 #include "fpdfsdk/pwl/ipwl_fillernotify.h"
 #include "public/fpdf_fwlevent.h"
+#include "third_party/base/numerics/safe_conversions.h"
 
 CPWL_ListBox::CPWL_ListBox(
     const CreateParams& cp,
@@ -211,7 +212,7 @@
   WideString swChange = GetText();
   WideString strChangeEx;
   int nSelStart = 0;
-  int nSelEnd = swChange.GetLength();
+  int nSelEnd = pdfium::base::checked_cast<int>(swChange.GetLength());
   bool bRC;
   bool bExit;
   std::tie(bRC, bExit) = m_pFillerNotify->OnBeforeKeyStroke(
diff --git a/fpdfsdk/pwl/cpwl_list_ctrl.cpp b/fpdfsdk/pwl/cpwl_list_ctrl.cpp
index af93591..99ef9dc 100644
--- a/fpdfsdk/pwl/cpwl_list_ctrl.cpp
+++ b/fpdfsdk/pwl/cpwl_list_ctrl.cpp
@@ -14,6 +14,7 @@
 #include "core/fxcrt/stl_util.h"
 #include "fpdfsdk/pwl/cpwl_edit_impl.h"
 #include "fpdfsdk/pwl/cpwl_list_box.h"
+#include "third_party/base/numerics/safe_conversions.h"
 
 CPWL_ListCtrl::NotifyIface::~NotifyIface() = default;
 
@@ -530,8 +531,10 @@
       bFirst = false;
     if (FXSYS_IsFloatSmaller(pt.y, rcListItem.bottom))
       bLast = false;
-    if (pt.y >= rcListItem.top && pt.y < rcListItem.bottom)
-      return &pListItem - &m_ListItems.front();
+    if (pt.y >= rcListItem.top && pt.y < rcListItem.bottom) {
+      return pdfium::base::checked_cast<int32_t>(&pListItem -
+                                                 &m_ListItems.front());
+    }
   }
   if (bFirst)
     return 0;
@@ -583,7 +586,7 @@
 int32_t CPWL_ListCtrl::GetLastSelected() const {
   for (auto iter = m_ListItems.rbegin(); iter != m_ListItems.rend(); ++iter) {
     if ((*iter)->IsSelected())
-      return &*iter - &m_ListItems.front();
+      return pdfium::base::checked_cast<int32_t>(&*iter - &m_ListItems.front());
   }
   return -1;
 }