summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael BrĂ¼ning <michael.bruning@qt.io>2018-11-02 13:36:21 +0100
committerMichael BrĂ¼ning <michael.bruning@qt.io>2018-11-02 16:51:06 +0000
commitbc188914f3ce1d2c82d2fd37f22e98de4dbd37e2 (patch)
tree7a877bc7b5918bd637fefd23783c3fb9faa3eefd
parentcb98d8cc5766b93f718a245c149dbd121ddd08fd (diff)
Fixup for fix for CVE-2018-17469
Commit ddd25ab971 introduced a build break because some const qualifiers that were needed were not part of the patch. Change-Id: I88e757885b92c0788a0adcee6732e5f2a7f213af Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_object.cpp6
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_object.h3
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_stream.cpp10
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_stream.h3
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_stream_acc.cpp2
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_stream_acc.h6
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/parser/fpdf_parser_decode.cpp14
-rw-r--r--chromium/third_party/pdfium/core/fpdfapi/parser/fpdf_parser_decode.h5
-rw-r--r--chromium/third_party/pdfium/fpdfsdk/fpdfview.cpp4
9 files changed, 32 insertions, 21 deletions
diff --git a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_object.cpp b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_object.cpp
index 67632a040c5..8dce9bd23da 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_object.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_object.cpp
@@ -55,7 +55,11 @@ int CPDF_Object::GetInteger() const {
return 0;
}
-CPDF_Dictionary* CPDF_Object::GetDict() const {
+CPDF_Dictionary* CPDF_Object::GetDict() {
+ return nullptr;
+}
+
+const CPDF_Dictionary* CPDF_Object::GetDict() const {
return nullptr;
}
diff --git a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_object.h b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_object.h
index 7a14492d70d..c5741585f9b 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_object.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_object.h
@@ -61,7 +61,8 @@ class CPDF_Object {
virtual WideString GetUnicodeText() const;
virtual float GetNumber() const;
virtual int GetInteger() const;
- virtual CPDF_Dictionary* GetDict() const;
+ virtual CPDF_Dictionary* GetDict();
+ virtual const CPDF_Dictionary* GetDict() const;
virtual void SetString(const ByteString& str);
diff --git a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_stream.cpp b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_stream.cpp
index 074e747a782..eeb083004df 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_stream.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_stream.cpp
@@ -36,7 +36,11 @@ CPDF_Object::Type CPDF_Stream::GetType() const {
return STREAM;
}
-CPDF_Dictionary* CPDF_Stream::GetDict() const {
+CPDF_Dictionary* CPDF_Stream::GetDict() {
+ return m_pDict.get();
+}
+
+const CPDF_Dictionary* CPDF_Stream::GetDict() const {
return m_pDict.get();
}
@@ -83,11 +87,11 @@ std::unique_ptr<CPDF_Object> CPDF_Stream::CloneNonCyclic(
pAcc->LoadAllDataRaw();
uint32_t streamSize = pAcc->GetSize();
- CPDF_Dictionary* pDict = GetDict();
+ const CPDF_Dictionary* pDict = GetDict();
std::unique_ptr<CPDF_Dictionary> pNewDict;
if (pDict && !pdfium::ContainsKey(*pVisited, pDict)) {
pNewDict = ToDictionary(
- static_cast<CPDF_Object*>(pDict)->CloneNonCyclic(bDirect, pVisited));
+ static_cast<const CPDF_Object*>(pDict)->CloneNonCyclic(bDirect, pVisited));
}
return pdfium::MakeUnique<CPDF_Stream>(pAcc->DetachData(), streamSize,
std::move(pNewDict));
diff --git a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_stream.h b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_stream.h
index f8b09af7e24..38128ce252a 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_stream.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_stream.h
@@ -29,7 +29,8 @@ class CPDF_Stream : public CPDF_Object {
// CPDF_Object:
Type GetType() const override;
std::unique_ptr<CPDF_Object> Clone() const override;
- CPDF_Dictionary* GetDict() const override;
+ CPDF_Dictionary* GetDict() override;
+ const CPDF_Dictionary* GetDict() const override;
WideString GetUnicodeText() const override;
bool IsStream() const override;
CPDF_Stream* AsStream() override;
diff --git a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_stream_acc.cpp b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_stream_acc.cpp
index d115b48226a..64a1a00eece 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_stream_acc.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_stream_acc.cpp
@@ -64,7 +64,7 @@ void CPDF_StreamAcc::LoadAllDataRaw() {
LoadAllData(true, 0, false);
}
-CPDF_Dictionary* CPDF_StreamAcc::GetDict() const {
+const CPDF_Dictionary* CPDF_StreamAcc::GetDict() const {
return m_pStream ? m_pStream->GetDict() : nullptr;
}
diff --git a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_stream_acc.h b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_stream_acc.h
index d54e000097c..bee7d59e373 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_stream_acc.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/parser/cpdf_stream_acc.h
@@ -28,13 +28,13 @@ class CPDF_StreamAcc : public Retainable {
void LoadAllDataRaw();
const CPDF_Stream* GetStream() const { return m_pStream.Get(); }
- CPDF_Dictionary* GetDict() const;
+ const CPDF_Dictionary* GetDict() const;
const uint8_t* GetData() const;
uint8_t* GetData();
uint32_t GetSize() const;
const ByteString& GetImageDecoder() const { return m_ImageDecoder; }
- const CPDF_Dictionary* GetImageParam() const { return m_pImageParam; }
+ const CPDF_Dictionary* GetImageParam() const { return m_pImageParam.Get(); }
std::unique_ptr<uint8_t, FxFreeDeleter> DetachData();
protected:
@@ -48,7 +48,7 @@ class CPDF_StreamAcc : public Retainable {
uint32_t m_dwSize = 0;
bool m_bNewBuf = false;
ByteString m_ImageDecoder;
- CPDF_Dictionary* m_pImageParam = nullptr;
+ UnownedPtr<const CPDF_Dictionary> m_pImageParam;
UnownedPtr<const CPDF_Stream> const m_pStream;
uint8_t* m_pSrcData = nullptr;
};
diff --git a/chromium/third_party/pdfium/core/fpdfapi/parser/fpdf_parser_decode.cpp b/chromium/third_party/pdfium/core/fpdfapi/parser/fpdf_parser_decode.cpp
index 915d4ad2288..1b6089e3198 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/parser/fpdf_parser_decode.cpp
+++ b/chromium/third_party/pdfium/core/fpdfapi/parser/fpdf_parser_decode.cpp
@@ -324,7 +324,7 @@ std::unique_ptr<CCodec_ScanlineDecoder> FPDFAPI_CreateFlateDecoder(
uint32_t FPDFAPI_FlateOrLZWDecode(bool bLZW,
const uint8_t* src_buf,
uint32_t src_size,
- CPDF_Dictionary* pParams,
+ const CPDF_Dictionary* pParams,
uint32_t estimated_size,
uint8_t** dest_buf,
uint32_t* dest_size) {
@@ -355,7 +355,7 @@ bool PDF_DataDecode(const uint8_t* src_buf,
uint8_t** dest_buf,
uint32_t* dest_size,
ByteString* ImageEncoding,
- CPDF_Dictionary** pImageParms) {
+ UnownedPtr<const CPDF_Dictionary>* pImageParams) {
CPDF_Object* pDecoder = pDict ? pDict->GetDirectObjectFor("Filter") : nullptr;
if (!pDecoder || (!pDecoder->IsArray() && !pDecoder->IsName()))
return false;
@@ -384,7 +384,7 @@ bool PDF_DataDecode(const uint8_t* src_buf,
for (size_t i = 0; i < nSize; ++i) {
int estimated_size = i == nSize - 1 ? last_estimated_size : 0;
ByteString decoder = DecoderArray[i].first;
- CPDF_Dictionary* pParam = ToDictionary(DecoderArray[i].second);
+ const CPDF_Dictionary* pParam = ToDictionary(DecoderArray[i].second);
uint8_t* new_buf = nullptr;
uint32_t new_size = 0xFFFFFFFF;
uint32_t offset = FX_INVALID_OFFSET;
@@ -395,7 +395,7 @@ bool PDF_DataDecode(const uint8_t* src_buf,
*ImageEncoding = "FlateDecode";
*dest_buf = last_buf;
*dest_size = last_size;
- *pImageParms = pParam;
+ *pImageParams = pParam;
return true;
}
offset = FPDFAPI_FlateOrLZWDecode(false, last_buf, last_size, pParam,
@@ -412,7 +412,7 @@ bool PDF_DataDecode(const uint8_t* src_buf,
*ImageEncoding = "RunLengthDecode";
*dest_buf = last_buf;
*dest_size = last_size;
- *pImageParms = pParam;
+ *pImageParams = pParam;
return true;
}
offset = RunLengthDecode(last_buf, last_size, &new_buf, &new_size);
@@ -423,7 +423,7 @@ bool PDF_DataDecode(const uint8_t* src_buf,
else if (decoder == "CCF")
decoder = "CCITTFaxDecode";
*ImageEncoding = decoder;
- *pImageParms = pParam;
+ *pImageParams = pParam;
*dest_buf = last_buf;
*dest_size = last_size;
return true;
@@ -438,7 +438,7 @@ bool PDF_DataDecode(const uint8_t* src_buf,
last_size = new_size;
}
ImageEncoding->clear();
- *pImageParms = nullptr;
+ *pImageParams = nullptr;
*dest_buf = last_buf;
*dest_size = last_size;
return true;
diff --git a/chromium/third_party/pdfium/core/fpdfapi/parser/fpdf_parser_decode.h b/chromium/third_party/pdfium/core/fpdfapi/parser/fpdf_parser_decode.h
index 6358b5d4cb3..96eb8044306 100644
--- a/chromium/third_party/pdfium/core/fpdfapi/parser/fpdf_parser_decode.h
+++ b/chromium/third_party/pdfium/core/fpdfapi/parser/fpdf_parser_decode.h
@@ -10,6 +10,7 @@
#include <memory>
#include "core/fxcrt/fx_string.h"
+#include "core/fxcrt/unowned_ptr.h"
class CCodec_ScanlineDecoder;
class CPDF_Array;
@@ -81,7 +82,7 @@ uint32_t HexDecode(const uint8_t* src_buf,
uint32_t FPDFAPI_FlateOrLZWDecode(bool bLZW,
const uint8_t* src_buf,
uint32_t src_size,
- CPDF_Dictionary* pParams,
+ const CPDF_Dictionary* pParams,
uint32_t estimated_size,
uint8_t** dest_buf,
uint32_t* dest_size);
@@ -94,6 +95,6 @@ bool PDF_DataDecode(const uint8_t* src_buf,
uint8_t** dest_buf,
uint32_t* dest_size,
ByteString* ImageEncoding,
- CPDF_Dictionary** pImageParms);
+ UnownedPtr<const CPDF_Dictionary>* pImageParams);
#endif // CORE_FPDFAPI_PARSER_FPDF_PARSER_DECODE_H_
diff --git a/chromium/third_party/pdfium/fpdfsdk/fpdfview.cpp b/chromium/third_party/pdfium/fpdfsdk/fpdfview.cpp
index f11515143bf..3007646eaac 100644
--- a/chromium/third_party/pdfium/fpdfsdk/fpdfview.cpp
+++ b/chromium/third_party/pdfium/fpdfsdk/fpdfview.cpp
@@ -390,14 +390,14 @@ unsigned long DecodeStreamMaybeCopyAndReturnLength(const CPDF_Stream* stream,
ASSERT(stream);
uint8_t* data = stream->GetRawData();
uint32_t len = stream->GetRawSize();
- CPDF_Dictionary* dict = stream->GetDict();
+ const CPDF_Dictionary* dict = stream->GetDict();
CPDF_Object* decoder = dict ? dict->GetDirectObjectFor("Filter") : nullptr;
if (decoder && (decoder->IsArray() || decoder->IsName())) {
// Decode the stream if one or more stream filters are specified.
uint8_t* decoded_data = nullptr;
uint32_t decoded_len = 0;
ByteString dummy_last_decoder;
- CPDF_Dictionary* dummy_last_param;
+ UnownedPtr<const CPDF_Dictionary> dummy_last_param;
if (PDF_DataDecode(data, len, dict, dict->GetIntegerFor("DL"), false,
&decoded_data, &decoded_len, &dummy_last_decoder,
&dummy_last_param)) {