Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(298)

Side by Side Diff: core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp

Issue 400083002: Fix garbled text when loading linearized pdf document (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1632 matching lines...) Expand 10 before | Expand all | Expand 10 after
1643 CPDF_StreamAcc* pStream; 1643 CPDF_StreamAcc* pStream;
1644 m_ObjectStreamMap.GetNextAssoc(pos, objnum, (void*&)pStream); 1644 m_ObjectStreamMap.GetNextAssoc(pos, objnum, (void*&)pStream);
1645 delete pStream; 1645 delete pStream;
1646 } 1646 }
1647 m_ObjectStreamMap.RemoveAll(); 1647 m_ObjectStreamMap.RemoveAll();
1648 if (!LoadLinearizedAllCrossRefV4(m_LastXRefOffset, m_dwXrefStartObjNum) && ! LoadLinearizedAllCrossRefV5(m_LastXRefOffset)) { 1648 if (!LoadLinearizedAllCrossRefV4(m_LastXRefOffset, m_dwXrefStartObjNum) && ! LoadLinearizedAllCrossRefV5(m_LastXRefOffset)) {
1649 m_LastXRefOffset = 0; 1649 m_LastXRefOffset = 0;
1650 m_Syntax.m_MetadataObjnum = dwSaveMetadataObjnum; 1650 m_Syntax.m_MetadataObjnum = dwSaveMetadataObjnum;
1651 return PDFPARSE_ERROR_FORMAT; 1651 return PDFPARSE_ERROR_FORMAT;
1652 } 1652 }
1653 FXSYS_qsort(m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_DW ORD), _CompareDWord); 1653 FXSYS_qsort(m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FI LESIZE), _CompareDWord);
Lei Zhang 2014/07/17 23:05:19 Wouldn't you want _CompareDWord() to be _CompareFi
Bo Xu 2014/07/17 23:13:17 That's right! Change made.
1654 m_Syntax.m_MetadataObjnum = dwSaveMetadataObjnum; 1654 m_Syntax.m_MetadataObjnum = dwSaveMetadataObjnum;
1655 return PDFPARSE_ERROR_SUCCESS; 1655 return PDFPARSE_ERROR_SUCCESS;
1656 } 1656 }
1657 CPDF_SyntaxParser::CPDF_SyntaxParser() 1657 CPDF_SyntaxParser::CPDF_SyntaxParser()
1658 { 1658 {
1659 m_pFileAccess = NULL; 1659 m_pFileAccess = NULL;
1660 m_pCryptoHandler = NULL; 1660 m_pCryptoHandler = NULL;
1661 m_pFileBuf = NULL; 1661 m_pFileBuf = NULL;
1662 m_BufSize = CPDF_ModuleMgr::Get()->m_FileBufSize; 1662 m_BufSize = CPDF_ModuleMgr::Get()->m_FileBufSize;
1663 m_pFileBuf = NULL; 1663 m_pFileBuf = NULL;
(...skipping 2720 matching lines...) Expand 10 before | Expand all | Expand 10 after
4384 { 4384 {
4385 FX_INT32 iSize = m_childNode.GetSize(); 4385 FX_INT32 iSize = m_childNode.GetSize();
4386 for (FX_INT32 i = 0; i < iSize; ++i) { 4386 for (FX_INT32 i = 0; i < iSize; ++i) {
4387 CPDF_PageNode *pNode = (CPDF_PageNode*)m_childNode[i]; 4387 CPDF_PageNode *pNode = (CPDF_PageNode*)m_childNode[i];
4388 if (pNode) { 4388 if (pNode) {
4389 delete pNode; 4389 delete pNode;
4390 } 4390 }
4391 } 4391 }
4392 m_childNode.RemoveAll(); 4392 m_childNode.RemoveAll();
4393 } 4393 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698