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 984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
995 result = result * 256 + p[i]; | 995 result = result * 256 + p[i]; |
996 } | 996 } |
997 return result; | 997 return result; |
998 } | 998 } |
999 FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE pos, FX_FILESIZE& prev, FX_BOOL bMainXRef) | 999 FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE pos, FX_FILESIZE& prev, FX_BOOL bMainXRef) |
1000 { | 1000 { |
1001 CPDF_Stream* pStream = (CPDF_Stream*)ParseIndirectObjectAt(m_pDocument, pos, 0, NULL); | 1001 CPDF_Stream* pStream = (CPDF_Stream*)ParseIndirectObjectAt(m_pDocument, pos, 0, NULL); |
1002 if (!pStream) { | 1002 if (!pStream) { |
1003 return FALSE; | 1003 return FALSE; |
1004 } | 1004 } |
1005 if (m_pDocument) { | 1005 if (m_pDocument && m_pDocument->GetRoot()->GetObjNum() != pStream->m_ObjNum) { |
Tom Sepez
2014/12/17 18:20:10
If there's no document, we now fail instead of jus
jun_fang
2014/12/17 19:55:53
I thought that it should return if there was no do
| |
1006 m_pDocument->InsertIndirectObject(pStream->m_ObjNum, pStream); | 1006 m_pDocument->InsertIndirectObject(pStream->m_ObjNum, pStream); |
1007 } else { | |
1008 if (pStream->GetType() == PDFOBJ_STREAM) { | |
1009 pStream->Release(); | |
1010 } | |
1011 return FALSE; | |
1007 } | 1012 } |
1008 if (pStream->GetType() != PDFOBJ_STREAM) { | 1013 if (pStream->GetType() != PDFOBJ_STREAM) { |
Tom Sepez
2014/12/17 18:20:10
can this test move to after line 1004? Then when
Tom Sepez
2014/12/17 18:21:28
Rather, there's no need to check before calling re
jun_fang
2014/12/17 19:55:53
Before this fix, release is only called when pStre
| |
1009 return FALSE; | 1014 return FALSE; |
1010 } | 1015 } |
1011 prev = pStream->GetDict()->GetInteger(FX_BSTRC("Prev")); | 1016 prev = pStream->GetDict()->GetInteger(FX_BSTRC("Prev")); |
1012 FX_INT32 size = pStream->GetDict()->GetInteger(FX_BSTRC("Size")); | 1017 FX_INT32 size = pStream->GetDict()->GetInteger(FX_BSTRC("Size")); |
1013 if (size < 0) { | 1018 if (size < 0) { |
1014 pStream->Release(); | 1019 pStream->Release(); |
1015 return FALSE; | 1020 return FALSE; |
1016 } | 1021 } |
1017 if (bMainXRef) { | 1022 if (bMainXRef) { |
1018 m_pTrailer = (CPDF_Dictionary*)pStream->GetDict()->Clone(); | 1023 m_pTrailer = (CPDF_Dictionary*)pStream->GetDict()->Clone(); |
(...skipping 3399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4418 { | 4423 { |
4419 FX_INT32 iSize = m_childNode.GetSize(); | 4424 FX_INT32 iSize = m_childNode.GetSize(); |
4420 for (FX_INT32 i = 0; i < iSize; ++i) { | 4425 for (FX_INT32 i = 0; i < iSize; ++i) { |
4421 CPDF_PageNode *pNode = (CPDF_PageNode*)m_childNode[i]; | 4426 CPDF_PageNode *pNode = (CPDF_PageNode*)m_childNode[i]; |
4422 if (pNode) { | 4427 if (pNode) { |
4423 delete pNode; | 4428 delete pNode; |
4424 } | 4429 } |
4425 } | 4430 } |
4426 m_childNode.RemoveAll(); | 4431 m_childNode.RemoveAll(); |
4427 } | 4432 } |
OLD | NEW |