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 4012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4023 if (!pBuf) { | 4023 if (!pBuf) { |
4024 m_docStatus = PDF_DATAAVAIL_ERROR; | 4024 m_docStatus = PDF_DATAAVAIL_ERROR; |
4025 return FALSE; | 4025 return FALSE; |
4026 } | 4026 } |
4027 if (!m_pFileRead->ReadBlock(pBuf, m_dwTrailerOffset, iSize)) { | 4027 if (!m_pFileRead->ReadBlock(pBuf, m_dwTrailerOffset, iSize)) { |
4028 return FALSE; | 4028 return FALSE; |
4029 } | 4029 } |
4030 CFX_SmartPointer<IFX_FileStream> file(FX_CreateMemoryStream(pBuf, (size_
t)iSize, FALSE)); | 4030 CFX_SmartPointer<IFX_FileStream> file(FX_CreateMemoryStream(pBuf, (size_
t)iSize, FALSE)); |
4031 m_syntaxParser.InitParser((IFX_FileStream*)file, 0); | 4031 m_syntaxParser.InitParser((IFX_FileStream*)file, 0); |
4032 CPDF_Object *pTrailer = m_syntaxParser.GetObject(NULL, 0, 0, 0); | 4032 CPDF_Object *pTrailer = m_syntaxParser.GetObject(NULL, 0, 0, 0); |
4033 if (pTrailer->GetType() != PDFOBJ_DICTIONARY) { | |
4034 return FALSE; | |
4035 } | |
4036 if (!pTrailer) { | 4033 if (!pTrailer) { |
4037 m_Pos += m_syntaxParser.SavePos(); | 4034 m_Pos += m_syntaxParser.SavePos(); |
4038 pHints->AddSegment(m_Pos, iTrailerSize); | 4035 pHints->AddSegment(m_Pos, iTrailerSize); |
4039 return FALSE; | 4036 return FALSE; |
4040 } | 4037 } |
| 4038 if (pTrailer->GetType() != PDFOBJ_DICTIONARY) { |
| 4039 return FALSE; |
| 4040 } |
4041 CPDF_Dictionary *pTrailerDict = pTrailer->GetDict(); | 4041 CPDF_Dictionary *pTrailerDict = pTrailer->GetDict(); |
4042 if (pTrailerDict) { | 4042 if (pTrailerDict) { |
4043 CPDF_Object *pEncrypt = pTrailerDict->GetElement("Encrypt"); | 4043 CPDF_Object *pEncrypt = pTrailerDict->GetElement("Encrypt"); |
4044 if (pEncrypt && pEncrypt->GetType() == PDFOBJ_REFERENCE) { | 4044 if (pEncrypt && pEncrypt->GetType() == PDFOBJ_REFERENCE) { |
4045 m_docStatus = PDF_DATAAVAIL_LOADALLFILE; | 4045 m_docStatus = PDF_DATAAVAIL_LOADALLFILE; |
4046 pTrailer->Release(); | 4046 pTrailer->Release(); |
4047 return TRUE; | 4047 return TRUE; |
4048 } | 4048 } |
4049 } | 4049 } |
4050 FX_DWORD xrefpos = GetDirectInteger(pTrailer->GetDict(), FX_BSTRC("Prev"
)); | 4050 FX_DWORD xrefpos = GetDirectInteger(pTrailer->GetDict(), FX_BSTRC("Prev"
)); |
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4628 { | 4628 { |
4629 FX_INT32 iSize = m_childNode.GetSize(); | 4629 FX_INT32 iSize = m_childNode.GetSize(); |
4630 for (FX_INT32 i = 0; i < iSize; ++i) { | 4630 for (FX_INT32 i = 0; i < iSize; ++i) { |
4631 CPDF_PageNode *pNode = (CPDF_PageNode*)m_childNode[i]; | 4631 CPDF_PageNode *pNode = (CPDF_PageNode*)m_childNode[i]; |
4632 if (pNode) { | 4632 if (pNode) { |
4633 delete pNode; | 4633 delete pNode; |
4634 } | 4634 } |
4635 } | 4635 } |
4636 m_childNode.RemoveAll(); | 4636 m_childNode.RemoveAll(); |
4637 } | 4637 } |
OLD | NEW |