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/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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 if (i == 0) | 289 if (i == 0) |
290 m_szSharedObjOffsetArray.push_back(m_szFirstPageObjOffset); | 290 m_szSharedObjOffsetArray.push_back(m_szFirstPageObjOffset); |
291 } else { | 291 } else { |
292 FX_SAFE_UINT32 safeObjNum = dwFirstSharedObjNum; | 292 FX_SAFE_UINT32 safeObjNum = dwFirstSharedObjNum; |
293 safeObjNum += i - m_nFirstPageSharedObjs; | 293 safeObjNum += i - m_nFirstPageSharedObjs; |
294 if (!safeObjNum.IsValid()) | 294 if (!safeObjNum.IsValid()) |
295 return FALSE; | 295 return FALSE; |
296 | 296 |
297 m_dwSharedObjNumArray.Add(safeObjNum.ValueOrDie()); | 297 m_dwSharedObjNumArray.Add(safeObjNum.ValueOrDie()); |
298 if (i == m_nFirstPageSharedObjs) { | 298 if (i == m_nFirstPageSharedObjs) { |
299 m_szSharedObjOffsetArray.push_back( | 299 FX_SAFE_FILESIZE safeLoc = dwFirstSharedObjLoc; |
300 pdfium::base::checked_cast<int32_t>(dwFirstSharedObjLoc)); | 300 if (!safeLoc.IsValid()) |
| 301 return FALSE; |
| 302 |
| 303 m_szSharedObjOffsetArray.push_back(safeLoc.ValueOrDie()); |
301 } | 304 } |
302 } | 305 } |
303 | 306 |
304 if (i != 0 && i != m_nFirstPageSharedObjs) { | 307 if (i != 0 && i != m_nFirstPageSharedObjs) { |
305 FX_SAFE_INT32 safeLoc = pdfium::base::checked_cast<int32_t>(dwPrevObjLen); | 308 FX_SAFE_FILESIZE safeLoc = dwPrevObjLen; |
306 safeLoc += m_szSharedObjOffsetArray[i - 1]; | 309 safeLoc += m_szSharedObjOffsetArray[i - 1]; |
307 if (!safeLoc.IsValid()) | 310 if (!safeLoc.IsValid()) |
308 return FALSE; | 311 return FALSE; |
309 | 312 |
310 m_szSharedObjOffsetArray.push_back(safeLoc.ValueOrDie()); | 313 m_szSharedObjOffsetArray.push_back(safeLoc.ValueOrDie()); |
311 } | 314 } |
312 } | 315 } |
313 | 316 |
314 if (dwSharedObjTotal > 0) { | 317 if (dwSharedObjTotal > 0) { |
315 FX_SAFE_INT32 safeLoc = pdfium::base::checked_cast<int32_t>(dwCurObjLen); | 318 FX_SAFE_FILESIZE safeLoc = dwCurObjLen; |
316 safeLoc += m_szSharedObjOffsetArray[dwSharedObjTotal - 1]; | 319 safeLoc += m_szSharedObjOffsetArray[dwSharedObjTotal - 1]; |
317 if (!safeLoc.IsValid()) | 320 if (!safeLoc.IsValid()) |
318 return FALSE; | 321 return FALSE; |
319 | 322 |
320 m_szSharedObjOffsetArray.push_back(safeLoc.ValueOrDie()); | 323 m_szSharedObjOffsetArray.push_back(safeLoc.ValueOrDie()); |
321 } | 324 } |
322 | 325 |
323 hStream->ByteAlign(); | 326 hStream->ByteAlign(); |
324 if (hStream->BitsRemaining() < dwSharedObjTotal) | 327 if (hStream->BitsRemaining() < dwSharedObjTotal) |
325 return FALSE; | 328 return FALSE; |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 CPDF_Array* pRange = m_pLinearizedDict->GetArrayBy("H"); | 479 CPDF_Array* pRange = m_pLinearizedDict->GetArrayBy("H"); |
477 if (!pRange) | 480 if (!pRange) |
478 return -1; | 481 return -1; |
479 | 482 |
480 CPDF_Object* pStreamLen = pRange->GetDirectObjectAt(1); | 483 CPDF_Object* pStreamLen = pRange->GetDirectObjectAt(1); |
481 if (!pStreamLen) | 484 if (!pStreamLen) |
482 return -1; | 485 return -1; |
483 | 486 |
484 return pStreamLen->GetInteger(); | 487 return pStreamLen->GetInteger(); |
485 } | 488 } |
OLD | NEW |