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

Side by Side Diff: core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp

Issue 2047723002: Check the hint table exists before using. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 6 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 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/ipdf_data_avail.h" 7 #include "core/fpdfapi/fpdf_parser/include/ipdf_data_avail.h"
8 8
9 #include "core/fpdfapi/fpdf_parser/cpdf_data_avail.h" 9 #include "core/fpdfapi/fpdf_parser/cpdf_data_avail.h"
10 #include "core/fpdfapi/fpdf_parser/fpdf_parser_utility.h" 10 #include "core/fpdfapi/fpdf_parser/fpdf_parser_utility.h"
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 return FALSE; 741 return FALSE;
742 } 742 }
743 743
744 int nPageCount = pDict->GetDirectObjectBy("N")->GetInteger(); 744 int nPageCount = pDict->GetDirectObjectBy("N")->GetInteger();
745 if (nPageCount <= 1) { 745 if (nPageCount <= 1) {
746 m_docStatus = PDF_DATAAVAIL_DONE; 746 m_docStatus = PDF_DATAAVAIL_DONE;
747 return TRUE; 747 return TRUE;
748 } 748 }
749 749
750 CPDF_Array* pHintStreamRange = pDict->GetArrayBy("H"); 750 CPDF_Array* pHintStreamRange = pDict->GetArrayBy("H");
751 if (!pHintStreamRange)
Lei Zhang 2016/06/08 01:40:53 In the bug, you mentioned this code infinite loops
752 return FALSE;
753
751 FX_FILESIZE szHSStart = 754 FX_FILESIZE szHSStart =
752 pHintStreamRange->GetDirectObjectAt(0) 755 pHintStreamRange->GetDirectObjectAt(0)
753 ? pHintStreamRange->GetDirectObjectAt(0)->GetInteger() 756 ? pHintStreamRange->GetDirectObjectAt(0)->GetInteger()
754 : 0; 757 : 0;
755 FX_FILESIZE szHSLength = 758 FX_FILESIZE szHSLength =
756 pHintStreamRange->GetDirectObjectAt(1) 759 pHintStreamRange->GetDirectObjectAt(1)
757 ? pHintStreamRange->GetDirectObjectAt(1)->GetInteger() 760 ? pHintStreamRange->GetDirectObjectAt(1)->GetInteger()
758 : 0; 761 : 0;
759 if (szHSStart < 0 || szHSLength <= 0) { 762 if (szHSStart < 0 || szHSLength <= 0) {
760 m_docStatus = PDF_DATAAVAIL_ERROR; 763 m_docStatus = PDF_DATAAVAIL_ERROR;
(...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after
1829 return FormAvailable; 1832 return FormAvailable;
1830 } 1833 }
1831 1834
1832 CPDF_DataAvail::PageNode::PageNode() : m_type(PDF_PAGENODE_UNKNOWN) {} 1835 CPDF_DataAvail::PageNode::PageNode() : m_type(PDF_PAGENODE_UNKNOWN) {}
1833 1836
1834 CPDF_DataAvail::PageNode::~PageNode() { 1837 CPDF_DataAvail::PageNode::~PageNode() {
1835 for (int32_t i = 0; i < m_childNode.GetSize(); ++i) 1838 for (int32_t i = 0; i < m_childNode.GetSize(); ++i)
1836 delete m_childNode[i]; 1839 delete m_childNode[i];
1837 m_childNode.RemoveAll(); 1840 m_childNode.RemoveAll();
1838 } 1841 }
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