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 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1027 } | 1027 } |
1028 CFX_DWordArray IndexArray, WidthArray; | 1028 CFX_DWordArray IndexArray, WidthArray; |
1029 FX_DWORD nSegs = 0; | 1029 FX_DWORD nSegs = 0; |
1030 CPDF_Array* pArray = pStream->GetDict()->GetArray(FX_BSTRC("Index")); | 1030 CPDF_Array* pArray = pStream->GetDict()->GetArray(FX_BSTRC("Index")); |
1031 if (pArray == NULL) { | 1031 if (pArray == NULL) { |
1032 IndexArray.Add(0); | 1032 IndexArray.Add(0); |
1033 IndexArray.Add(size); | 1033 IndexArray.Add(size); |
1034 nSegs = 1; | 1034 nSegs = 1; |
1035 } else { | 1035 } else { |
1036 for (FX_DWORD i = 0; i < pArray->GetCount(); i ++) { | 1036 for (FX_DWORD i = 0; i < pArray->GetCount(); i ++) { |
1037 IndexArray.Add(pArray->GetInteger(i)); | 1037 CPDF_Object* pObj = pArray->GetElement(i); |
1038 if (pObj && (pObj->GetType() == PDFOBJ_NUMBER)) { | |
Tom Sepez
2014/09/08 17:56:18
nit: no need for inner parenthesis here.
jun_fang
2014/09/09 18:51:25
For fuzz tests, elements in the index array can be
| |
1039 IndexArray.Add(pObj->GetInteger()); | |
1040 } | |
Tom Sepez
2014/09/08 17:56:18
This looks like one of those arrays which needs to
| |
1038 } | 1041 } |
1039 nSegs = pArray->GetCount() / 2; | 1042 nSegs = IndexArray.GetSize() / 2; |
1040 } | 1043 } |
Tom Sepez
2014/09/08 17:56:18
nit: I worry about a change down the road where In
| |
1041 pArray = pStream->GetDict()->GetArray(FX_BSTRC("W")); | 1044 pArray = pStream->GetDict()->GetArray(FX_BSTRC("W")); |
1042 if (pArray == NULL) { | 1045 if (pArray == NULL) { |
1043 pStream->Release(); | 1046 pStream->Release(); |
1044 return FALSE; | 1047 return FALSE; |
1045 } | 1048 } |
1046 FX_DWORD totalwidth = 0; | 1049 FX_DWORD totalwidth = 0; |
1047 FX_DWORD i; | 1050 FX_DWORD i; |
1048 for (i = 0; i < pArray->GetCount(); i ++) { | 1051 for (i = 0; i < pArray->GetCount(); i ++) { |
1049 WidthArray.Add(pArray->GetInteger(i)); | 1052 WidthArray.Add(pArray->GetInteger(i)); |
1050 if (totalwidth + WidthArray[i] < totalwidth) { | 1053 if (totalwidth + WidthArray[i] < totalwidth) { |
(...skipping 3374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4425 { | 4428 { |
4426 FX_INT32 iSize = m_childNode.GetSize(); | 4429 FX_INT32 iSize = m_childNode.GetSize(); |
4427 for (FX_INT32 i = 0; i < iSize; ++i) { | 4430 for (FX_INT32 i = 0; i < iSize; ++i) { |
4428 CPDF_PageNode *pNode = (CPDF_PageNode*)m_childNode[i]; | 4431 CPDF_PageNode *pNode = (CPDF_PageNode*)m_childNode[i]; |
4429 if (pNode) { | 4432 if (pNode) { |
4430 delete pNode; | 4433 delete pNode; |
4431 } | 4434 } |
4432 } | 4435 } |
4433 m_childNode.RemoveAll(); | 4436 m_childNode.RemoveAll(); |
4434 } | 4437 } |
OLD | NEW |