Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2165)

Unified Diff: core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp

Issue 2230883003: Relax a check in CPDF_HintTables. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: more Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp
diff --git a/core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp b/core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp
index fd723a8fa802f404b6e4d150ef92388eb2767b67..63a64a302691f5b8ca63cdf1b1f674cd437d8c4a 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp
@@ -296,13 +296,16 @@ FX_BOOL CPDF_HintTables::ReadSharedObjHintTable(CFX_BitStream* hStream,
m_dwSharedObjNumArray.Add(safeObjNum.ValueOrDie());
if (i == m_nFirstPageSharedObjs) {
- m_szSharedObjOffsetArray.push_back(
- pdfium::base::checked_cast<int32_t>(dwFirstSharedObjLoc));
+ FX_SAFE_FILESIZE safeLoc = dwFirstSharedObjLoc;
+ if (!safeLoc.IsValid())
+ return FALSE;
+
+ m_szSharedObjOffsetArray.push_back(safeLoc.ValueOrDie());
}
}
if (i != 0 && i != m_nFirstPageSharedObjs) {
- FX_SAFE_INT32 safeLoc = pdfium::base::checked_cast<int32_t>(dwPrevObjLen);
+ FX_SAFE_FILESIZE safeLoc = dwPrevObjLen;
safeLoc += m_szSharedObjOffsetArray[i - 1];
if (!safeLoc.IsValid())
return FALSE;
@@ -312,7 +315,7 @@ FX_BOOL CPDF_HintTables::ReadSharedObjHintTable(CFX_BitStream* hStream,
}
if (dwSharedObjTotal > 0) {
- FX_SAFE_INT32 safeLoc = pdfium::base::checked_cast<int32_t>(dwCurObjLen);
+ FX_SAFE_FILESIZE safeLoc = dwCurObjLen;
safeLoc += m_szSharedObjOffsetArray[dwSharedObjTotal - 1];
if (!safeLoc.IsValid())
return FALSE;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698