| 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 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 m_pTrailer = NULL; | 627 m_pTrailer = NULL; |
| 628 } | 628 } |
| 629 FX_INT32 status = 0; | 629 FX_INT32 status = 0; |
| 630 FX_INT32 inside_index = 0; | 630 FX_INT32 inside_index = 0; |
| 631 FX_DWORD objnum, gennum; | 631 FX_DWORD objnum, gennum; |
| 632 FX_INT32 depth = 0; | 632 FX_INT32 depth = 0; |
| 633 FX_LPBYTE buffer = FX_Alloc(FX_BYTE, 4096); | 633 FX_LPBYTE buffer = FX_Alloc(FX_BYTE, 4096); |
| 634 FX_FILESIZE pos = m_Syntax.m_HeaderOffset; | 634 FX_FILESIZE pos = m_Syntax.m_HeaderOffset; |
| 635 FX_FILESIZE start_pos, start_pos1; | 635 FX_FILESIZE start_pos, start_pos1; |
| 636 FX_FILESIZE last_obj = -1, last_xref = -1, last_trailer = -1; | 636 FX_FILESIZE last_obj = -1, last_xref = -1, last_trailer = -1; |
| 637 // TODO(tsepez): unused bInUpdate seems suspicious. |
| 637 FX_BOOL bInUpdate = FALSE; | 638 FX_BOOL bInUpdate = FALSE; |
| 638 while (pos < m_Syntax.m_FileLen) { | 639 while (pos < m_Syntax.m_FileLen) { |
| 639 FX_BOOL bOverFlow = FALSE; | 640 FX_BOOL bOverFlow = FALSE; |
| 640 FX_DWORD size = (FX_DWORD)(m_Syntax.m_FileLen - pos); | 641 FX_DWORD size = (FX_DWORD)(m_Syntax.m_FileLen - pos); |
| 641 if (size > 4096) { | 642 if (size > 4096) { |
| 642 size = 4096; | 643 size = 4096; |
| 643 } | 644 } |
| 644 if (!m_Syntax.m_pFileAccess->ReadBlock(buffer, pos, size)) { | 645 if (!m_Syntax.m_pFileAccess->ReadBlock(buffer, pos, size)) { |
| 645 break; | 646 break; |
| 646 } | 647 } |
| (...skipping 1498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2145 } | 2146 } |
| 2146 if (word[0] == '/') { | 2147 if (word[0] == '/') { |
| 2147 if (bTypeOnly) { | 2148 if (bTypeOnly) { |
| 2148 return (CPDF_Object*)PDFOBJ_NAME; | 2149 return (CPDF_Object*)PDFOBJ_NAME; |
| 2149 } | 2150 } |
| 2150 pRet = CPDF_Name::Create(PDF_NameDecode(CFX_ByteStringC(m_WordBuffer + 1
, m_WordSize - 1))); | 2151 pRet = CPDF_Name::Create(PDF_NameDecode(CFX_ByteStringC(m_WordBuffer + 1
, m_WordSize - 1))); |
| 2151 return pRet; | 2152 return pRet; |
| 2152 } | 2153 } |
| 2153 if (word == FX_BSTRC("<<")) { | 2154 if (word == FX_BSTRC("<<")) { |
| 2154 FX_FILESIZE saveDictOffset = m_Pos - 2; | 2155 FX_FILESIZE saveDictOffset = m_Pos - 2; |
| 2156 // TODO(tsepez): unused dwDictSize seems suspicous. |
| 2155 FX_DWORD dwDictSize = 0; | 2157 FX_DWORD dwDictSize = 0; |
| 2156 if (bTypeOnly) { | 2158 if (bTypeOnly) { |
| 2157 return (CPDF_Object*)PDFOBJ_DICTIONARY; | 2159 return (CPDF_Object*)PDFOBJ_DICTIONARY; |
| 2158 } | 2160 } |
| 2159 if (pContext) { | 2161 if (pContext) { |
| 2160 pContext->m_DictStart = SavedPos; | 2162 pContext->m_DictStart = SavedPos; |
| 2161 } | 2163 } |
| 2162 CPDF_Dictionary* pDict = CPDF_Dictionary::Create(); | 2164 CPDF_Dictionary* pDict = CPDF_Dictionary::Create(); |
| 2163 FX_INT32 nKeys = 0; | 2165 FX_INT32 nKeys = 0; |
| 2164 FX_FILESIZE dwSignValuePos = 0; | 2166 FX_FILESIZE dwSignValuePos = 0; |
| (...skipping 2261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4426 { | 4428 { |
| 4427 FX_INT32 iSize = m_childNode.GetSize(); | 4429 FX_INT32 iSize = m_childNode.GetSize(); |
| 4428 for (FX_INT32 i = 0; i < iSize; ++i) { | 4430 for (FX_INT32 i = 0; i < iSize; ++i) { |
| 4429 CPDF_PageNode *pNode = (CPDF_PageNode*)m_childNode[i]; | 4431 CPDF_PageNode *pNode = (CPDF_PageNode*)m_childNode[i]; |
| 4430 if (pNode) { | 4432 if (pNode) { |
| 4431 delete pNode; | 4433 delete pNode; |
| 4432 } | 4434 } |
| 4433 } | 4435 } |
| 4434 m_childNode.RemoveAll(); | 4436 m_childNode.RemoveAll(); |
| 4435 } | 4437 } |
| OLD | NEW |