| OLD | NEW |
| 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/parser/cpdf_hint_tables.h" | 7 #include "core/fpdfapi/parser/cpdf_hint_tables.h" |
| 8 | 8 |
| 9 #include <limits> | 9 #include <limits> |
| 10 | 10 |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 | 250 |
| 251 int nStreamOffset = ReadPrimaryHintStreamOffset(); | 251 int nStreamOffset = ReadPrimaryHintStreamOffset(); |
| 252 int nStreamLen = ReadPrimaryHintStreamLength(); | 252 int nStreamLen = ReadPrimaryHintStreamLength(); |
| 253 if (nStreamOffset < 0 || nStreamLen < 1) | 253 if (nStreamOffset < 0 || nStreamLen < 1) |
| 254 return false; | 254 return false; |
| 255 | 255 |
| 256 FX_SAFE_UINT32 bit_offset = offset; | 256 FX_SAFE_UINT32 bit_offset = offset; |
| 257 bit_offset *= 8; | 257 bit_offset *= 8; |
| 258 if (!bit_offset.IsValid() || hStream->GetPos() > bit_offset.ValueOrDie()) | 258 if (!bit_offset.IsValid() || hStream->GetPos() > bit_offset.ValueOrDie()) |
| 259 return false; | 259 return false; |
| 260 hStream->SkipBits(bit_offset.ValueOrDie() - hStream->GetPos()); | 260 hStream->SkipBits((bit_offset - hStream->GetPos()).ValueOrDie()); |
| 261 | 261 |
| 262 const uint32_t kHeaderSize = 192; | 262 const uint32_t kHeaderSize = 192; |
| 263 if (hStream->BitsRemaining() < kHeaderSize) | 263 if (hStream->BitsRemaining() < kHeaderSize) |
| 264 return false; | 264 return false; |
| 265 | 265 |
| 266 // Item 1: The object number of the first object in the shared objects | 266 // Item 1: The object number of the first object in the shared objects |
| 267 // section. | 267 // section. |
| 268 uint32_t dwFirstSharedObjNum = hStream->GetBits(32); | 268 uint32_t dwFirstSharedObjNum = hStream->GetBits(32); |
| 269 | 269 |
| 270 // Item 2: The location of the first object in the shared objects section. | 270 // Item 2: The location of the first object in the shared objects section. |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 return static_cast<int>(m_pLinearized->GetFirstPageNo()); | 503 return static_cast<int>(m_pLinearized->GetFirstPageNo()); |
| 504 } | 504 } |
| 505 | 505 |
| 506 int CPDF_HintTables::ReadPrimaryHintStreamOffset() const { | 506 int CPDF_HintTables::ReadPrimaryHintStreamOffset() const { |
| 507 return static_cast<int>(m_pLinearized->GetHintStart()); | 507 return static_cast<int>(m_pLinearized->GetHintStart()); |
| 508 } | 508 } |
| 509 | 509 |
| 510 int CPDF_HintTables::ReadPrimaryHintStreamLength() const { | 510 int CPDF_HintTables::ReadPrimaryHintStreamLength() const { |
| 511 return static_cast<int>(m_pLinearized->GetHintLength()); | 511 return static_cast<int>(m_pLinearized->GetHintLength()); |
| 512 } | 512 } |
| OLD | NEW |