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/include/fpdfapi/cpdf_parser.h" | 7 #include "core/include/fpdfapi/cpdf_parser.h" |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1143 | 1143 |
1144 CPDF_Object* CPDF_Parser::ParseIndirectObject( | 1144 CPDF_Object* CPDF_Parser::ParseIndirectObject( |
1145 CPDF_IndirectObjectHolder* pObjList, | 1145 CPDF_IndirectObjectHolder* pObjList, |
1146 FX_DWORD objnum) { | 1146 FX_DWORD objnum) { |
1147 if (!IsValidObjectNumber(objnum)) | 1147 if (!IsValidObjectNumber(objnum)) |
1148 return nullptr; | 1148 return nullptr; |
1149 | 1149 |
1150 // Prevent circular parsing the same object. | 1150 // Prevent circular parsing the same object. |
1151 if (pdfium::ContainsKey(m_ParsingObjNums, objnum)) | 1151 if (pdfium::ContainsKey(m_ParsingObjNums, objnum)) |
1152 return nullptr; | 1152 return nullptr; |
1153 ScopedSetInsertion<FX_DWORD> local_insert(&m_ParsingObjNums, objnum); | |
1154 | 1153 |
| 1154 pdfium::ScopedSetInsertion<FX_DWORD> local_insert(&m_ParsingObjNums, objnum); |
1155 if (GetObjectType(objnum) == 1 || GetObjectType(objnum) == 255) { | 1155 if (GetObjectType(objnum) == 1 || GetObjectType(objnum) == 255) { |
1156 FX_FILESIZE pos = m_ObjectInfo[objnum].pos; | 1156 FX_FILESIZE pos = m_ObjectInfo[objnum].pos; |
1157 if (pos <= 0) | 1157 if (pos <= 0) |
1158 return nullptr; | 1158 return nullptr; |
1159 return ParseIndirectObjectAt(pObjList, pos, objnum); | 1159 return ParseIndirectObjectAt(pObjList, pos, objnum); |
1160 } | 1160 } |
1161 if (GetObjectType(objnum) != 2) | 1161 if (GetObjectType(objnum) != 2) |
1162 return nullptr; | 1162 return nullptr; |
1163 | 1163 |
1164 CPDF_StreamAcc* pObjStream = GetObjectStream(m_ObjectInfo[objnum].pos); | 1164 CPDF_StreamAcc* pObjStream = GetObjectStream(m_ObjectInfo[objnum].pos); |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1637 if (!LoadLinearizedAllCrossRefV4(m_LastXRefOffset, m_dwXrefStartObjNum) && | 1637 if (!LoadLinearizedAllCrossRefV4(m_LastXRefOffset, m_dwXrefStartObjNum) && |
1638 !LoadLinearizedAllCrossRefV5(m_LastXRefOffset)) { | 1638 !LoadLinearizedAllCrossRefV5(m_LastXRefOffset)) { |
1639 m_LastXRefOffset = 0; | 1639 m_LastXRefOffset = 0; |
1640 m_pSyntax->m_MetadataObjnum = dwSaveMetadataObjnum; | 1640 m_pSyntax->m_MetadataObjnum = dwSaveMetadataObjnum; |
1641 return FORMAT_ERROR; | 1641 return FORMAT_ERROR; |
1642 } | 1642 } |
1643 | 1643 |
1644 m_pSyntax->m_MetadataObjnum = dwSaveMetadataObjnum; | 1644 m_pSyntax->m_MetadataObjnum = dwSaveMetadataObjnum; |
1645 return SUCCESS; | 1645 return SUCCESS; |
1646 } | 1646 } |
OLD | NEW |