Store 2 unrelated GetSize() results in appropriate data types.
Avoid storing results in 32-bit ints, when the results can potentially
be bigger.
Change-Id: Iaa99648b3ec50842e74cd99eca734f08384b9be1
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/96611
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fpdfapi/parser/cpdf_crypto_handler.cpp b/core/fpdfapi/parser/cpdf_crypto_handler.cpp
index 44a2a6a..326f3a2 100644
--- a/core/fpdfapi/parser/cpdf_crypto_handler.cpp
+++ b/core/fpdfapi/parser/cpdf_crypto_handler.cpp
@@ -144,7 +144,7 @@
return true;
}
if (m_Cipher == Cipher::kRC4) {
- int old_size = dest_buf.GetSize();
+ size_t old_size = dest_buf.GetSize();
dest_buf.AppendBlock(source.data(), source.size());
CRYPT_ArcFourCrypt(static_cast<CRYPT_rc4_context*>(context),
dest_buf.GetSpan().subspan(old_size, source.size()));
diff --git a/fxjs/xfa/cfxjse_formcalc_context.cpp b/fxjs/xfa/cfxjse_formcalc_context.cpp
index 0079272..575b49c 100644
--- a/fxjs/xfa/cfxjse_formcalc_context.cpp
+++ b/fxjs/xfa/cfxjse_formcalc_context.cpp
@@ -4510,7 +4510,7 @@
if (!pFile)
return;
- int32_t size = pFile->GetSize();
+ FX_FILESIZE size = pFile->GetSize();
DataVector<uint8_t> dataBuf(size);
pFile->ReadBlock(dataBuf.data(), size);
info.GetReturnValue().Set(