Use span rather than raw string in FindSubWordLength().

Remove comment about speed/safety, it's implied by the
nature of spans.

Change-Id: I30cf66c55a8e265a93afe9b191c7244f3a46ad35
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/52657
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/fxjs/fx_date_helpers.cpp b/fxjs/fx_date_helpers.cpp
index df553b6..d728965 100644
--- a/fxjs/fx_date_helpers.cpp
+++ b/fxjs/fx_date_helpers.cpp
@@ -165,14 +165,9 @@
 }
 
 size_t FindSubWordLength(const WideString& str, size_t nStart) {
-  // It is safer, but slower to use WideString::operator[]. Although this code
-  // is normally not performance critical, fuzzers will exercise this code with
-  // very long values for |str|. To keep the fuzzers from timing out, get the
-  // raw string here, and be very careful while accessing it.
-  const wchar_t* data = str.c_str();
-  size_t length = str.GetLength();
+  pdfium::span<const wchar_t> data = str.AsSpan();
   size_t i = nStart;
-  while (i < length && std::iswalnum(data[i]))
+  while (i < data.size() && std::iswalnum(data[i]))
     ++i;
   return i - nStart;
 }