| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 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/include/fpdfapi/fpdf_parser.h" | 7 #include "core/include/fpdfapi/fpdf_parser.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 4833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4844 } | 4844 } |
| 4845 } | 4845 } |
| 4846 return IPDF_DataAvail::DataAvailable; | 4846 return IPDF_DataAvail::DataAvailable; |
| 4847 } | 4847 } |
| 4848 | 4848 |
| 4849 FX_BOOL CPDF_HintTables::LoadHintStream(CPDF_Stream* pHintStream) { | 4849 FX_BOOL CPDF_HintTables::LoadHintStream(CPDF_Stream* pHintStream) { |
| 4850 if (!pHintStream || !m_pLinearizedDict) | 4850 if (!pHintStream || !m_pLinearizedDict) |
| 4851 return FALSE; | 4851 return FALSE; |
| 4852 CPDF_Dictionary* pDict = pHintStream->GetDict(); | 4852 CPDF_Dictionary* pDict = pHintStream->GetDict(); |
| 4853 CPDF_Object* pOffset = pDict ? pDict->GetElement("S") : nullptr; | 4853 CPDF_Object* pOffset = pDict ? pDict->GetElement("S") : nullptr; |
| 4854 if (!pOffset || pOffset->GetType() != CPDF_Object::NUMBER) | 4854 if (!pOffset || !pOffset->IsNumber()) |
| 4855 return FALSE; | 4855 return FALSE; |
| 4856 int shared_hint_table_offset = pOffset->GetInteger(); | 4856 int shared_hint_table_offset = pOffset->GetInteger(); |
| 4857 CPDF_StreamAcc acc; | 4857 CPDF_StreamAcc acc; |
| 4858 acc.LoadAllData(pHintStream); | 4858 acc.LoadAllData(pHintStream); |
| 4859 FX_DWORD size = acc.GetSize(); | 4859 FX_DWORD size = acc.GetSize(); |
| 4860 // The header section of page offset hint table is 36 bytes. | 4860 // The header section of page offset hint table is 36 bytes. |
| 4861 // The header section of shared object hint table is 24 bytes. | 4861 // The header section of shared object hint table is 24 bytes. |
| 4862 // Hint table has at least 60 bytes. | 4862 // Hint table has at least 60 bytes. |
| 4863 const FX_DWORD MIN_STREAM_LEN = 60; | 4863 const FX_DWORD MIN_STREAM_LEN = 60; |
| 4864 if (size < MIN_STREAM_LEN || shared_hint_table_offset <= 0 || | 4864 if (size < MIN_STREAM_LEN || shared_hint_table_offset <= 0 || |
| (...skipping 22 matching lines...) Expand all Loading... |
| 4887 if (!m_pLinearizedDict) | 4887 if (!m_pLinearizedDict) |
| 4888 return -1; | 4888 return -1; |
| 4889 CPDF_Array* pRange = m_pLinearizedDict->GetArray("H"); | 4889 CPDF_Array* pRange = m_pLinearizedDict->GetArray("H"); |
| 4890 if (!pRange) | 4890 if (!pRange) |
| 4891 return -1; | 4891 return -1; |
| 4892 CPDF_Object* pStreamLen = pRange->GetElementValue(1); | 4892 CPDF_Object* pStreamLen = pRange->GetElementValue(1); |
| 4893 if (!pStreamLen) | 4893 if (!pStreamLen) |
| 4894 return -1; | 4894 return -1; |
| 4895 return pStreamLen->GetInteger(); | 4895 return pStreamLen->GetInteger(); |
| 4896 } | 4896 } |
| OLD | NEW |