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/fpdfapi/fpdf_parser/include/cpdf_parser.h" | 7 #include "core/fpdfapi/fpdf_parser/include/cpdf_parser.h" |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1003 | 1003 |
1004 if (arrIndex.size() == 0) | 1004 if (arrIndex.size() == 0) |
1005 arrIndex.push_back(std::make_pair(0, size)); | 1005 arrIndex.push_back(std::make_pair(0, size)); |
1006 | 1006 |
1007 pArray = pStream->GetDict()->GetArrayBy("W"); | 1007 pArray = pStream->GetDict()->GetArrayBy("W"); |
1008 if (!pArray) { | 1008 if (!pArray) { |
1009 pStream->Release(); | 1009 pStream->Release(); |
1010 return FALSE; | 1010 return FALSE; |
1011 } | 1011 } |
1012 | 1012 |
1013 CFX_DWordArray WidthArray; | 1013 CFX_ArrayTemplate<FX_DWORD> WidthArray; |
1014 FX_SAFE_DWORD dwAccWidth = 0; | 1014 FX_SAFE_DWORD dwAccWidth = 0; |
1015 for (FX_DWORD i = 0; i < pArray->GetCount(); i++) { | 1015 for (FX_DWORD i = 0; i < pArray->GetCount(); i++) { |
1016 WidthArray.Add(pArray->GetIntegerAt(i)); | 1016 WidthArray.Add(pArray->GetIntegerAt(i)); |
1017 dwAccWidth += WidthArray[i]; | 1017 dwAccWidth += WidthArray[i]; |
1018 } | 1018 } |
1019 | 1019 |
1020 if (!dwAccWidth.IsValid() || WidthArray.GetSize() < 3) { | 1020 if (!dwAccWidth.IsValid() || WidthArray.GetSize() < 3) { |
1021 pStream->Release(); | 1021 pStream->Release(); |
1022 return FALSE; | 1022 return FALSE; |
1023 } | 1023 } |
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1643 if (!LoadLinearizedAllCrossRefV4(m_LastXRefOffset, m_dwXrefStartObjNum) && | 1643 if (!LoadLinearizedAllCrossRefV4(m_LastXRefOffset, m_dwXrefStartObjNum) && |
1644 !LoadLinearizedAllCrossRefV5(m_LastXRefOffset)) { | 1644 !LoadLinearizedAllCrossRefV5(m_LastXRefOffset)) { |
1645 m_LastXRefOffset = 0; | 1645 m_LastXRefOffset = 0; |
1646 m_pSyntax->m_MetadataObjnum = dwSaveMetadataObjnum; | 1646 m_pSyntax->m_MetadataObjnum = dwSaveMetadataObjnum; |
1647 return FORMAT_ERROR; | 1647 return FORMAT_ERROR; |
1648 } | 1648 } |
1649 | 1649 |
1650 m_pSyntax->m_MetadataObjnum = dwSaveMetadataObjnum; | 1650 m_pSyntax->m_MetadataObjnum = dwSaveMetadataObjnum; |
1651 return SUCCESS; | 1651 return SUCCESS; |
1652 } | 1652 } |
OLD | NEW |