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

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

Issue 2298753003: Check first page number in CPDF_HintTables::ReadPageHintTable(). (Closed)
Patch Set: Created 4 years, 3 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/cpdf_hint_tables.h" 7 #include "core/fpdfapi/fpdf_parser/cpdf_hint_tables.h"
8 8
9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h"
10 #include "core/fpdfapi/fpdf_parser/include/cpdf_data_avail.h" 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_data_avail.h"
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 return false; 158 return false;
159 159
160 dwPageLenArray.push_back(safePageLen.ValueOrDie()); 160 dwPageLenArray.push_back(safePageLen.ValueOrDie());
161 } 161 }
162 162
163 int nOffsetE = GetEndOfFirstPageOffset(); 163 int nOffsetE = GetEndOfFirstPageOffset();
164 if (nOffsetE < 0) 164 if (nOffsetE < 0)
165 return false; 165 return false;
166 166
167 int nFirstPageNum = GetFirstPageNumber(); 167 int nFirstPageNum = GetFirstPageNumber();
168 if (nFirstPageNum < 0)
Tom Sepez 2016/08/31 21:58:10 Is there a reason this isn't just unsigned all the
Lei Zhang 2016/08/31 23:45:51 PDF number objects have signed values.
169 return false;
170
168 for (int i = 0; i < nPages; ++i) { 171 for (int i = 0; i < nPages; ++i) {
169 if (i == nFirstPageNum) { 172 if (i == nFirstPageNum) {
170 m_szPageOffsetArray.push_back(m_szFirstPageObjOffset); 173 m_szPageOffsetArray.push_back(m_szFirstPageObjOffset);
171 } else if (i == nFirstPageNum + 1) { 174 } else if (i == nFirstPageNum + 1) {
172 if (i == 1) { 175 if (i == 1) {
173 m_szPageOffsetArray.push_back(nOffsetE); 176 m_szPageOffsetArray.push_back(nOffsetE);
174 } else { 177 } else {
175 m_szPageOffsetArray.push_back(m_szPageOffsetArray[i - 2] + 178 m_szPageOffsetArray.push_back(m_szPageOffsetArray[i - 2] +
176 dwPageLenArray[i - 2]); 179 dwPageLenArray[i - 2]);
177 } 180 }
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 } 500 }
498 501
499 int CPDF_HintTables::ReadPrimaryHintStream(int index) const { 502 int CPDF_HintTables::ReadPrimaryHintStream(int index) const {
500 CPDF_Array* pRange = m_pLinearizedDict->GetArrayBy("H"); 503 CPDF_Array* pRange = m_pLinearizedDict->GetArrayBy("H");
501 if (!pRange) 504 if (!pRange)
502 return -1; 505 return -1;
503 506
504 CPDF_Object* pStreamLen = pRange->GetDirectObjectAt(index); 507 CPDF_Object* pStreamLen = pRange->GetDirectObjectAt(index);
505 return pStreamLen ? pStreamLen->GetInteger() : -1; 508 return pStreamLen ? pStreamLen->GetInteger() : -1;
506 } 509 }
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