diff options
Diffstat (limited to 'core/fpdfapi')
-rw-r--r-- | core/fpdfapi/parser/cpdf_object_stream.h | 3 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_parser.cpp | 13 |
2 files changed, 14 insertions, 2 deletions
diff --git a/core/fpdfapi/parser/cpdf_object_stream.h b/core/fpdfapi/parser/cpdf_object_stream.h index 816c1be77e..44aa8f72e5 100644 --- a/core/fpdfapi/parser/cpdf_object_stream.h +++ b/core/fpdfapi/parser/cpdf_object_stream.h @@ -33,6 +33,9 @@ class CPDF_ObjectStream { bool HasObject(uint32_t obj_number) const; std::unique_ptr<CPDF_Object> ParseObject(CPDF_IndirectObjectHolder* pObjList, uint32_t obj_number) const; + const std::map<uint32_t, uint32_t>& objects_offsets() const { + return objects_offsets_; + } protected: explicit CPDF_ObjectStream(const CPDF_Stream* stream); diff --git a/core/fpdfapi/parser/cpdf_parser.cpp b/core/fpdfapi/parser/cpdf_parser.cpp index d4ad0656e6..4d3835795c 100644 --- a/core/fpdfapi/parser/cpdf_parser.cpp +++ b/core/fpdfapi/parser/cpdf_parser.cpp @@ -650,8 +650,6 @@ bool CPDF_Parser::RebuildCrossRef() { const FX_FILESIZE obj_pos = numbers[0].second; const uint32_t obj_num = numbers[0].first; const uint32_t gen_num = numbers[1].first; - if (obj_num < kMaxObjectNumber) - cross_ref_table->AddNormal(obj_num, gen_num, obj_pos); m_pSyntax->SetPos(obj_pos); const std::unique_ptr<CPDF_Stream> pStream = @@ -664,6 +662,17 @@ bool CPDF_Parser::RebuildCrossRef() { pdfium::MakeUnique<CPDF_CrossRefTable>( ToDictionary(pStream->GetDict()->Clone()))); } + + if (obj_num < kMaxObjectNumber) { + cross_ref_table->AddNormal(obj_num, gen_num, obj_pos); + if (const auto object_stream = + CPDF_ObjectStream::Create(pStream.get())) { + for (const auto& it : object_stream->objects_offsets()) { + if (it.first < kMaxObjectNumber) + cross_ref_table->AddCompressed(it.first, obj_num); + } + } + } } numbers.clear(); } |