| OLD | NEW |
| 1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "core/fpdfapi/fpdf_parser/cpdf_hint_tables.h" | 7 #include "core/fpdfapi/fpdf_parser/cpdf_hint_tables.h" |
| 8 | 8 |
| 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" | 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" |
| 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_data_avail.h" | 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_data_avail.h" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 if (!dwSharedIdBits) | 115 if (!dwSharedIdBits) |
| 116 return FALSE; | 116 return FALSE; |
| 117 | 117 |
| 118 // Item 13: Skip Item 13 which has 16 bits. | 118 // Item 13: Skip Item 13 which has 16 bits. |
| 119 hStream->SkipBits(16); | 119 hStream->SkipBits(16); |
| 120 | 120 |
| 121 // Sanity check values from the page table header. 2^|kMaxBits| should be more | 121 // Sanity check values from the page table header. 2^|kMaxBits| should be more |
| 122 // than enough to represent most of the values here. | 122 // than enough to represent most of the values here. |
| 123 constexpr uint32_t kMaxBits = 34; | 123 constexpr uint32_t kMaxBits = 34; |
| 124 if (dwSharedObjBits > kMaxBits || dwDeltaObjectsBits > kMaxBits || | 124 if (dwSharedObjBits > kMaxBits || dwDeltaObjectsBits > kMaxBits || |
| 125 dwSharedIdBits > kMaxBits) { | 125 dwDeltaPageLenBits > kMaxBits || dwSharedIdBits > kMaxBits) { |
| 126 return false; | 126 return false; |
| 127 } | 127 } |
| 128 | 128 |
| 129 const int nPages = GetNumberOfPages(); | 129 const int nPages = GetNumberOfPages(); |
| 130 if (nPages < 1 || nPages >= FPDF_PAGE_MAX_NUM) | 130 if (nPages < 1 || nPages >= FPDF_PAGE_MAX_NUM) |
| 131 return false; | 131 return false; |
| 132 | 132 |
| 133 const uint32_t dwPages = pdfium::base::checked_cast<uint32_t>(nPages); | 133 const uint32_t dwPages = pdfium::base::checked_cast<uint32_t>(nPages); |
| 134 FX_SAFE_UINT32 required_bits = dwDeltaObjectsBits; | 134 FX_SAFE_UINT32 required_bits = dwDeltaObjectsBits; |
| 135 required_bits *= dwPages; | 135 required_bits *= dwPages; |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 } | 491 } |
| 492 | 492 |
| 493 int CPDF_HintTables::ReadPrimaryHintStream(int index) const { | 493 int CPDF_HintTables::ReadPrimaryHintStream(int index) const { |
| 494 CPDF_Array* pRange = m_pLinearizedDict->GetArrayBy("H"); | 494 CPDF_Array* pRange = m_pLinearizedDict->GetArrayBy("H"); |
| 495 if (!pRange) | 495 if (!pRange) |
| 496 return -1; | 496 return -1; |
| 497 | 497 |
| 498 CPDF_Object* pStreamLen = pRange->GetDirectObjectAt(index); | 498 CPDF_Object* pStreamLen = pRange->GetDirectObjectAt(index); |
| 499 return pStreamLen ? pStreamLen->GetInteger() : -1; | 499 return pStreamLen ? pStreamLen->GetInteger() : -1; |
| 500 } | 500 } |
| OLD | NEW |