Add debugging data to help diagnose a hang in fread()

Use pdfium::Alias() to save the path that is being read and the file
size.

Bug: 376633555
Change-Id: I7358b75a3d286791aa65f53b9118d39be63b0fe1
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/127910
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Thomas Sepez <tsepez@google.com>
diff --git a/core/fxge/cfx_folderfontinfo.cpp b/core/fxge/cfx_folderfontinfo.cpp
index af936b9..7c13863 100644
--- a/core/fxge/cfx_folderfontinfo.cpp
+++ b/core/fxge/cfx_folderfontinfo.cpp
@@ -6,6 +6,7 @@
 
 #include "core/fxge/cfx_folderfontinfo.h"
 
+#include <algorithm>
 #include <array>
 #include <iterator>
 #include <limits>
@@ -16,6 +17,7 @@
 #include "core/fxcrt/check_op.h"
 #include "core/fxcrt/compiler_specific.h"
 #include "core/fxcrt/containers/contains.h"
+#include "core/fxcrt/debug/alias.h"
 #include "core/fxcrt/fixed_size_data_vector.h"
 #include "core/fxcrt/fx_codepage.h"
 #include "core/fxcrt/fx_extension.h"
@@ -430,6 +432,15 @@
   if (fseek(pFile.get(), offset, SEEK_SET) < 0) {
     return 0;
   }
+
+  // TODO(crbug.com/376633555): Remove debugging data after fixing the bug.
+  pdfium::Alias(&datasize);
+  char buf[256] = {};
+  pdfium::Alias(&buf);
+  ByteStringView font_path = pFont->m_FilePath.AsStringView();
+  size_t path_char_count = std::min(font_path.GetLength(), std::size(buf));
+  fxcrt::spancpy(pdfium::span(buf), font_path.Last(path_char_count).span());
+
   if (UNSAFE_TODO(fread(buffer.data(), datasize, 1, pFile.get())) != 1) {
     return 0;
   }