summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-11-07 15:16:01 -0800
committerCommit bot <commit-bot@chromium.org>2016-11-07 15:16:01 -0800
commit4e597c8fd5d604273266ea19a1074a2c870ba224 (patch)
tree6311f6884e5316cb0c481cc141a08f8984cbfa6e /core
parent0d830c1e0db684d17f9b3c534dec8cecb17b674d (diff)
downloadpdfium-4e597c8fd5d604273266ea19a1074a2c870ba224.tar.xz
Force compiler to deduce src type for checked_cast<dst, src>.
Otherwise, we might be silently doing an unsafe cast before applying the check if the actual argument doesn't match the exact src type. Review-Url: https://codereview.chromium.org/2484953003
Diffstat (limited to 'core')
-rw-r--r--core/fpdfapi/parser/cpdf_parser.cpp6
-rw-r--r--core/fpdfdoc/cpdf_formfield.cpp2
2 files changed, 3 insertions, 5 deletions
diff --git a/core/fpdfapi/parser/cpdf_parser.cpp b/core/fpdfapi/parser/cpdf_parser.cpp
index cf23ec7cd7..ed20cf73f4 100644
--- a/core/fpdfapi/parser/cpdf_parser.cpp
+++ b/core/fpdfapi/parser/cpdf_parser.cpp
@@ -1015,10 +1015,8 @@ bool CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, bool bMainXRef) {
if (startnum < 0)
continue;
- m_dwXrefStartObjNum =
- pdfium::base::checked_cast<uint32_t, int32_t>(startnum);
- uint32_t count =
- pdfium::base::checked_cast<uint32_t, int32_t>(arrIndex[i].second);
+ m_dwXrefStartObjNum = pdfium::base::checked_cast<uint32_t>(startnum);
+ uint32_t count = pdfium::base::checked_cast<uint32_t>(arrIndex[i].second);
FX_SAFE_UINT32 dwCaculatedSize = segindex;
dwCaculatedSize += count;
dwCaculatedSize *= totalWidth;
diff --git a/core/fpdfdoc/cpdf_formfield.cpp b/core/fpdfdoc/cpdf_formfield.cpp
index e2240c9f2f..8170b7fcbf 100644
--- a/core/fpdfdoc/cpdf_formfield.cpp
+++ b/core/fpdfdoc/cpdf_formfield.cpp
@@ -682,7 +682,7 @@ int CPDF_FormField::InsertOption(CFX_WideString csOptLabel,
m_pDict->SetFor("Opt", pOpt);
}
- int iCount = pdfium::base::checked_cast<int, size_t>(pOpt->GetCount());
+ int iCount = pdfium::base::checked_cast<int>(pOpt->GetCount());
if (index >= iCount) {
pOpt->AddString(csStr);
index = iCount;