summaryrefslogtreecommitdiff
path: root/core/fpdfapi/parser
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi/parser')
-rw-r--r--core/fpdfapi/parser/cpdf_crypto_handler.cpp2
-rw-r--r--core/fpdfapi/parser/cpdf_hint_tables.cpp2
-rw-r--r--core/fpdfapi/parser/cpdf_parser.cpp4
-rw-r--r--core/fpdfapi/parser/cpdf_stream.cpp6
-rw-r--r--core/fpdfapi/parser/cpdf_stream_acc.cpp8
-rw-r--r--core/fpdfapi/parser/cpdf_stream_acc.h6
-rw-r--r--core/fpdfapi/parser/fpdf_parser_utility.cpp2
7 files changed, 19 insertions, 11 deletions
diff --git a/core/fpdfapi/parser/cpdf_crypto_handler.cpp b/core/fpdfapi/parser/cpdf_crypto_handler.cpp
index e8f0265ae4..d963df4887 100644
--- a/core/fpdfapi/parser/cpdf_crypto_handler.cpp
+++ b/core/fpdfapi/parser/cpdf_crypto_handler.cpp
@@ -327,7 +327,7 @@ std::unique_ptr<CPDF_Object> CPDF_CryptoHandler::DecryptObjectTree(
// TODO(art-snake): Move decryption into the CPDF_Stream class.
CPDF_Stream* stream = child->AsStream();
auto stream_access = pdfium::MakeRetain<CPDF_StreamAcc>(stream);
- stream_access->LoadAllData(true);
+ stream_access->LoadAllDataRaw();
if (IsCipherAES() && stream_access->GetSize() < 16) {
stream->SetData(nullptr, 0);
diff --git a/core/fpdfapi/parser/cpdf_hint_tables.cpp b/core/fpdfapi/parser/cpdf_hint_tables.cpp
index 2b58e9d8f3..c9123d4b97 100644
--- a/core/fpdfapi/parser/cpdf_hint_tables.cpp
+++ b/core/fpdfapi/parser/cpdf_hint_tables.cpp
@@ -471,7 +471,7 @@ bool CPDF_HintTables::LoadHintStream(CPDF_Stream* pHintStream) {
return false;
auto pAcc = pdfium::MakeRetain<CPDF_StreamAcc>(pHintStream);
- pAcc->LoadAllData();
+ pAcc->LoadAllDataFiltered();
uint32_t size = pAcc->GetSize();
// The header section of page offset hint table is 36 bytes.
diff --git a/core/fpdfapi/parser/cpdf_parser.cpp b/core/fpdfapi/parser/cpdf_parser.cpp
index 4e77773a3b..0d1b02a5ce 100644
--- a/core/fpdfapi/parser/cpdf_parser.cpp
+++ b/core/fpdfapi/parser/cpdf_parser.cpp
@@ -1096,7 +1096,7 @@ bool CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, bool bMainXRef) {
uint32_t totalWidth = dwAccWidth.ValueOrDie();
auto pAcc = pdfium::MakeRetain<CPDF_StreamAcc>(pStream);
- pAcc->LoadAllData();
+ pAcc->LoadAllDataFiltered();
const uint8_t* pData = pAcc->GetData();
uint32_t dwTotalSize = pAcc->GetSize();
@@ -1250,7 +1250,7 @@ RetainPtr<CPDF_StreamAcc> CPDF_Parser::GetObjectStream(uint32_t objnum) {
return nullptr;
auto pStreamAcc = pdfium::MakeRetain<CPDF_StreamAcc>(pStream);
- pStreamAcc->LoadAllData();
+ pStreamAcc->LoadAllDataFiltered();
m_ObjectStreamMap[objnum] = pStreamAcc;
return pStreamAcc;
}
diff --git a/core/fpdfapi/parser/cpdf_stream.cpp b/core/fpdfapi/parser/cpdf_stream.cpp
index bf2feaed22..074e747a78 100644
--- a/core/fpdfapi/parser/cpdf_stream.cpp
+++ b/core/fpdfapi/parser/cpdf_stream.cpp
@@ -80,7 +80,7 @@ std::unique_ptr<CPDF_Object> CPDF_Stream::CloneNonCyclic(
std::set<const CPDF_Object*>* pVisited) const {
pVisited->insert(this);
auto pAcc = pdfium::MakeRetain<CPDF_StreamAcc>(this);
- pAcc->LoadAllData(true);
+ pAcc->LoadAllDataRaw();
uint32_t streamSize = pAcc->GetSize();
CPDF_Dictionary* pDict = GetDict();
@@ -147,7 +147,7 @@ bool CPDF_Stream::HasFilter() const {
WideString CPDF_Stream::GetUnicodeText() const {
auto pAcc = pdfium::MakeRetain<CPDF_StreamAcc>(this);
- pAcc->LoadAllData(false);
+ pAcc->LoadAllDataFiltered();
return PDF_DecodeText(pAcc->GetData(), pAcc->GetSize());
}
@@ -156,7 +156,7 @@ bool CPDF_Stream::WriteTo(IFX_ArchiveStream* archive) const {
return false;
auto pAcc = pdfium::MakeRetain<CPDF_StreamAcc>(this);
- pAcc->LoadAllData(true);
+ pAcc->LoadAllDataRaw();
return archive->WriteBlock(pAcc->GetData(), pAcc->GetSize()) &&
archive->WriteString("\r\nendstream");
}
diff --git a/core/fpdfapi/parser/cpdf_stream_acc.cpp b/core/fpdfapi/parser/cpdf_stream_acc.cpp
index 5792a80d14..d115b48226 100644
--- a/core/fpdfapi/parser/cpdf_stream_acc.cpp
+++ b/core/fpdfapi/parser/cpdf_stream_acc.cpp
@@ -56,6 +56,14 @@ void CPDF_StreamAcc::LoadAllData(bool bRawAccess,
m_bNewBuf = m_pData != m_pStream->GetRawData();
}
+void CPDF_StreamAcc::LoadAllDataFiltered() {
+ LoadAllData(false, 0, false);
+}
+
+void CPDF_StreamAcc::LoadAllDataRaw() {
+ LoadAllData(true, 0, false);
+}
+
CPDF_Dictionary* CPDF_StreamAcc::GetDict() const {
return m_pStream ? m_pStream->GetDict() : nullptr;
}
diff --git a/core/fpdfapi/parser/cpdf_stream_acc.h b/core/fpdfapi/parser/cpdf_stream_acc.h
index 52ac7e2e05..d54e000097 100644
--- a/core/fpdfapi/parser/cpdf_stream_acc.h
+++ b/core/fpdfapi/parser/cpdf_stream_acc.h
@@ -23,9 +23,9 @@ class CPDF_StreamAcc : public Retainable {
CPDF_StreamAcc(const CPDF_StreamAcc&) = delete;
CPDF_StreamAcc& operator=(const CPDF_StreamAcc&) = delete;
- void LoadAllData(bool bRawAccess = false,
- uint32_t estimated_size = 0,
- bool bImageAcc = false);
+ void LoadAllData(bool bRawAccess, uint32_t estimated_size, bool bImageAcc);
+ void LoadAllDataFiltered();
+ void LoadAllDataRaw();
const CPDF_Stream* GetStream() const { return m_pStream.Get(); }
CPDF_Dictionary* GetDict() const;
diff --git a/core/fpdfapi/parser/fpdf_parser_utility.cpp b/core/fpdfapi/parser/fpdf_parser_utility.cpp
index 2185e88ff6..45284a4ceb 100644
--- a/core/fpdfapi/parser/fpdf_parser_utility.cpp
+++ b/core/fpdfapi/parser/fpdf_parser_utility.cpp
@@ -209,7 +209,7 @@ std::ostream& operator<<(std::ostream& buf, const CPDF_Object* pObj) {
const CPDF_Stream* p = pObj->AsStream();
buf << p->GetDict() << "stream\r\n";
auto pAcc = pdfium::MakeRetain<CPDF_StreamAcc>(p);
- pAcc->LoadAllData(true);
+ pAcc->LoadAllDataRaw();
buf.write(reinterpret_cast<const char*>(pAcc->GetData()),
pAcc->GetSize());
buf << "\r\nendstream";