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 "../../../include/fpdfapi/fpdf_parser.h" | 7 #include "../../../include/fpdfapi/fpdf_parser.h" |
8 #include "../../../include/fpdfapi/fpdf_module.h" | 8 #include "../../../include/fpdfapi/fpdf_module.h" |
9 #include "../../../include/fpdfapi/fpdf_page.h" | 9 #include "../../../include/fpdfapi/fpdf_page.h" |
10 #include "../../../../third_party/numerics/safe_math.h" | 10 #include "../../../../third_party/numerics/safe_math.h" |
(...skipping 4008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4019 if (!pBuf) { | 4019 if (!pBuf) { |
4020 m_docStatus = PDF_DATAAVAIL_ERROR; | 4020 m_docStatus = PDF_DATAAVAIL_ERROR; |
4021 return FALSE; | 4021 return FALSE; |
4022 } | 4022 } |
4023 if (!m_pFileRead->ReadBlock(pBuf, m_dwTrailerOffset, iSize)) { | 4023 if (!m_pFileRead->ReadBlock(pBuf, m_dwTrailerOffset, iSize)) { |
4024 return FALSE; | 4024 return FALSE; |
4025 } | 4025 } |
4026 CFX_SmartPointer<IFX_FileStream> file(FX_CreateMemoryStream(pBuf, (size_
t)iSize, FALSE)); | 4026 CFX_SmartPointer<IFX_FileStream> file(FX_CreateMemoryStream(pBuf, (size_
t)iSize, FALSE)); |
4027 m_syntaxParser.InitParser((IFX_FileStream*)file, 0); | 4027 m_syntaxParser.InitParser((IFX_FileStream*)file, 0); |
4028 CPDF_Object *pTrailer = m_syntaxParser.GetObject(NULL, 0, 0, 0); | 4028 CPDF_Object *pTrailer = m_syntaxParser.GetObject(NULL, 0, 0, 0); |
4029 if (pTrailer->GetType() != PDFOBJ_DICTIONARY) { | |
4030 return FALSE; | |
4031 } | |
4032 if (!pTrailer) { | 4029 if (!pTrailer) { |
4033 m_Pos += m_syntaxParser.SavePos(); | 4030 m_Pos += m_syntaxParser.SavePos(); |
4034 pHints->AddSegment(m_Pos, iTrailerSize); | 4031 pHints->AddSegment(m_Pos, iTrailerSize); |
4035 return FALSE; | 4032 return FALSE; |
4036 } | 4033 } |
| 4034 if (pTrailer->GetType() != PDFOBJ_DICTIONARY) { |
| 4035 return FALSE; |
| 4036 } |
4037 CPDF_Dictionary *pTrailerDict = pTrailer->GetDict(); | 4037 CPDF_Dictionary *pTrailerDict = pTrailer->GetDict(); |
4038 if (pTrailerDict) { | 4038 if (pTrailerDict) { |
4039 CPDF_Object *pEncrypt = pTrailerDict->GetElement("Encrypt"); | 4039 CPDF_Object *pEncrypt = pTrailerDict->GetElement("Encrypt"); |
4040 if (pEncrypt && pEncrypt->GetType() == PDFOBJ_REFERENCE) { | 4040 if (pEncrypt && pEncrypt->GetType() == PDFOBJ_REFERENCE) { |
4041 m_docStatus = PDF_DATAAVAIL_LOADALLFILE; | 4041 m_docStatus = PDF_DATAAVAIL_LOADALLFILE; |
4042 pTrailer->Release(); | 4042 pTrailer->Release(); |
4043 return TRUE; | 4043 return TRUE; |
4044 } | 4044 } |
4045 } | 4045 } |
4046 FX_DWORD xrefpos = GetDirectInteger(pTrailer->GetDict(), FX_BSTRC("Prev"
)); | 4046 FX_DWORD xrefpos = GetDirectInteger(pTrailer->GetDict(), FX_BSTRC("Prev"
)); |
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4624 { | 4624 { |
4625 FX_INT32 iSize = m_childNode.GetSize(); | 4625 FX_INT32 iSize = m_childNode.GetSize(); |
4626 for (FX_INT32 i = 0; i < iSize; ++i) { | 4626 for (FX_INT32 i = 0; i < iSize; ++i) { |
4627 CPDF_PageNode *pNode = (CPDF_PageNode*)m_childNode[i]; | 4627 CPDF_PageNode *pNode = (CPDF_PageNode*)m_childNode[i]; |
4628 if (pNode) { | 4628 if (pNode) { |
4629 delete pNode; | 4629 delete pNode; |
4630 } | 4630 } |
4631 } | 4631 } |
4632 m_childNode.RemoveAll(); | 4632 m_childNode.RemoveAll(); |
4633 } | 4633 } |
OLD | NEW |