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

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

Issue 2242723002: Avoid an undefined shift in ReadPageHintTable(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: Created 4 years, 4 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_data_avail.h" 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_data_avail.h"
10 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 102
103 // Item 12: The number of bits needed to represent the numerator of 103 // Item 12: The number of bits needed to represent the numerator of
104 // the fractional position for each shared object reference. For each 104 // the fractional position for each shared object reference. For each
105 // shared object referenced from a page, there is an indication of 105 // shared object referenced from a page, there is an indication of
106 // where in the page's content stream the object is first referenced. 106 // where in the page's content stream the object is first referenced.
107 uint32_t dwSharedNumeratorBits = hStream->GetBits(16); 107 uint32_t dwSharedNumeratorBits = hStream->GetBits(16);
108 108
109 // Item 13: Skip Item 13 which has 16 bits. 109 // Item 13: Skip Item 13 which has 16 bits.
110 hStream->SkipBits(16); 110 hStream->SkipBits(16);
111 111
112 if (dwSharedObjBits >= 40)
Tom Sepez 2016/08/12 15:29:12 nit: can we make this kMumbleSomethingBits add add
Lei Zhang 2016/08/13 02:47:14 Done.
113 return FALSE;
114
112 CPDF_Object* pPageNum = m_pLinearizedDict->GetDirectObjectBy("N"); 115 CPDF_Object* pPageNum = m_pLinearizedDict->GetDirectObjectBy("N");
113 int nPages = pPageNum ? pPageNum->GetInteger() : 0; 116 int nPages = pPageNum ? pPageNum->GetInteger() : 0;
114 if (nPages < 1) 117 if (nPages < 1)
115 return FALSE; 118 return FALSE;
116 119
117 FX_SAFE_UINT32 required_bits = dwDeltaObjectsBits; 120 FX_SAFE_UINT32 required_bits = dwDeltaObjectsBits;
118 required_bits *= pdfium::base::checked_cast<uint32_t>(nPages); 121 required_bits *= pdfium::base::checked_cast<uint32_t>(nPages);
119 if (!CanReadFromBitStream(hStream, required_bits)) 122 if (!CanReadFromBitStream(hStream, required_bits))
120 return FALSE; 123 return FALSE;
121 124
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 CPDF_Array* pRange = m_pLinearizedDict->GetArrayBy("H"); 482 CPDF_Array* pRange = m_pLinearizedDict->GetArrayBy("H");
480 if (!pRange) 483 if (!pRange)
481 return -1; 484 return -1;
482 485
483 CPDF_Object* pStreamLen = pRange->GetDirectObjectAt(1); 486 CPDF_Object* pStreamLen = pRange->GetDirectObjectAt(1);
484 if (!pStreamLen) 487 if (!pStreamLen)
485 return -1; 488 return -1;
486 489
487 return pStreamLen->GetInteger(); 490 return pStreamLen->GetInteger();
488 } 491 }
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