summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp b/core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp
index 63a64a3026..7a3fbacfb3 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp
@@ -109,6 +109,12 @@ FX_BOOL CPDF_HintTables::ReadPageHintTable(CFX_BitStream* hStream) {
// Item 13: Skip Item 13 which has 16 bits.
hStream->SkipBits(16);
+ // The maximum number of bits allowed to represent the greatest number of
+ // shared object references. 2^39 should be more than enough.
+ constexpr uint32_t kMaxSharedObjBits = 39;
+ if (dwSharedObjBits > kMaxSharedObjBits)
+ return FALSE;
+
CPDF_Object* pPageNum = m_pLinearizedDict->GetDirectObjectBy("N");
int nPages = pPageNum ? pPageNum->GetInteger() : 0;
if (nPages < 1)