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/page/pageint.h" | 7 #include "core/fpdfapi/page/pageint.h" |
8 | 8 |
9 #include <limits.h> | 9 #include <limits.h> |
10 | 10 |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 if (first_char == '[') { | 378 if (first_char == '[') { |
379 if ((!bAllowNestedArray && dwInArrayLevel) || | 379 if ((!bAllowNestedArray && dwInArrayLevel) || |
380 dwInArrayLevel > kMaxNestedArrayLevel) { | 380 dwInArrayLevel > kMaxNestedArrayLevel) { |
381 return nullptr; | 381 return nullptr; |
382 } | 382 } |
383 | 383 |
384 CPDF_Array* pArray = new CPDF_Array; | 384 CPDF_Array* pArray = new CPDF_Array; |
385 while (1) { | 385 while (1) { |
386 CPDF_Object* pObj = ReadNextObject(bAllowNestedArray, dwInArrayLevel + 1); | 386 CPDF_Object* pObj = ReadNextObject(bAllowNestedArray, dwInArrayLevel + 1); |
387 if (pObj) { | 387 if (pObj) { |
388 pArray->Add(pObj); | 388 pArray->Add(pdfium::WrapUnique(pObj)); |
389 continue; | 389 continue; |
390 } | 390 } |
391 | |
392 if (!m_WordSize || m_WordBuffer[0] == ']') | 391 if (!m_WordSize || m_WordBuffer[0] == ']') |
393 break; | 392 break; |
394 } | 393 } |
395 return pArray; | 394 return pArray; |
396 } | 395 } |
397 | 396 |
398 if (m_WordSize == 5 && !memcmp(m_WordBuffer, "false", 5)) | 397 if (m_WordSize == 5 && !memcmp(m_WordBuffer, "false", 5)) |
399 return new CPDF_Boolean(false); | 398 return new CPDF_Boolean(false); |
400 | 399 |
401 if (m_WordSize == 4) { | 400 if (m_WordSize == 4) { |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 | 617 |
619 if (buf.GetLength() > kMaxStringLength) | 618 if (buf.GetLength() > kMaxStringLength) |
620 return CFX_ByteString(buf.GetBuffer(), kMaxStringLength); | 619 return CFX_ByteString(buf.GetBuffer(), kMaxStringLength); |
621 | 620 |
622 return buf.MakeString(); | 621 return buf.MakeString(); |
623 } | 622 } |
624 | 623 |
625 bool CPDF_StreamParser::PositionIsInBounds() const { | 624 bool CPDF_StreamParser::PositionIsInBounds() const { |
626 return m_Pos < m_Size; | 625 return m_Pos < m_Size; |
627 } | 626 } |
OLD | NEW |