From d3d8287e143daf12a602a919c120b4e0c656abf8 Mon Sep 17 00:00:00 2001 From: Henrique Nakashima Date: Tue, 5 Jun 2018 16:19:11 +0000 Subject: Create m_ContentStream field in CPDF_PageObject. Content streams are now split and can set nonzero values to identify each parsed content stream. Bug: pdfium:1051 Change-Id: Ia2cb1e0997db5264d468043af31f9b41e8d0d349 Reviewed-on: https://pdfium-review.googlesource.com/33591 Commit-Queue: Henrique Nakashima Reviewed-by: Ryan Harrison --- .../edit/cpdf_pagecontentgenerator_unittest.cpp | 12 ++++++------ core/fpdfapi/page/cpdf_contentparser.cpp | 2 +- core/fpdfapi/page/cpdf_formobject.cpp | 7 +++++-- core/fpdfapi/page/cpdf_formobject.h | 4 +++- core/fpdfapi/page/cpdf_imageobject.cpp | 3 ++- core/fpdfapi/page/cpdf_imageobject.h | 2 +- core/fpdfapi/page/cpdf_pageobject.cpp | 3 ++- core/fpdfapi/page/cpdf_pageobject.h | 4 +++- core/fpdfapi/page/cpdf_pathobject.cpp | 3 ++- core/fpdfapi/page/cpdf_pathobject.h | 2 +- core/fpdfapi/page/cpdf_shadingobject.cpp | 5 +++-- core/fpdfapi/page/cpdf_shadingobject.h | 4 +++- core/fpdfapi/page/cpdf_streamcontentparser.cpp | 21 +++++++++++++-------- core/fpdfapi/page/cpdf_streamcontentparser.h | 6 +++++- core/fpdfapi/page/cpdf_textobject.cpp | 5 +++-- core/fpdfapi/page/cpdf_textobject.h | 2 +- core/fpdfapi/render/cpdf_renderstatus.cpp | 4 ++-- fpdfsdk/fpdf_editimg.cpp | 2 +- fpdfsdk/fpdf_editpath.cpp | 4 ++-- fpdfsdk/fpdf_edittext.cpp | 4 ++-- 20 files changed, 61 insertions(+), 38 deletions(-) diff --git a/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp b/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp index 1244b12331..f1dbffeccf 100644 --- a/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp +++ b/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp @@ -49,7 +49,7 @@ class CPDF_PageContentGeneratorTest : public testing::Test { }; TEST_F(CPDF_PageContentGeneratorTest, ProcessRect) { - auto pPathObj = pdfium::MakeUnique(); + auto pPathObj = pdfium::MakeUnique(-1); pPathObj->m_Path.AppendRect(10, 5, 13, 30); pPathObj->m_FillType = FXFILL_ALTERNATE; pPathObj->m_bStroke = true; @@ -60,7 +60,7 @@ TEST_F(CPDF_PageContentGeneratorTest, ProcessRect) { TestProcessPath(&generator, &buf, pPathObj.get()); EXPECT_EQ("q 1 0 0 1 0 0 cm 10 5 3 25 re B* Q\n", ByteString(buf)); - pPathObj = pdfium::MakeUnique(); + pPathObj = pdfium::MakeUnique(-1); pPathObj->m_Path.AppendPoint(CFX_PointF(0, 0), FXPT_TYPE::MoveTo, false); pPathObj->m_Path.AppendPoint(CFX_PointF(5.2f, 0), FXPT_TYPE::LineTo, false); pPathObj->m_Path.AppendPoint(CFX_PointF(5.2f, 3.78f), FXPT_TYPE::LineTo, @@ -75,7 +75,7 @@ TEST_F(CPDF_PageContentGeneratorTest, ProcessRect) { } TEST_F(CPDF_PageContentGeneratorTest, ProcessPath) { - auto pPathObj = pdfium::MakeUnique(); + auto pPathObj = pdfium::MakeUnique(-1); pPathObj->m_Path.AppendPoint(CFX_PointF(3.102f, 4.67f), FXPT_TYPE::MoveTo, false); pPathObj->m_Path.AppendPoint(CFX_PointF(5.45f, 0.29f), FXPT_TYPE::LineTo, @@ -110,7 +110,7 @@ TEST_F(CPDF_PageContentGeneratorTest, ProcessPath) { } TEST_F(CPDF_PageContentGeneratorTest, ProcessGraphics) { - auto pPathObj = pdfium::MakeUnique(); + auto pPathObj = pdfium::MakeUnique(-1); pPathObj->m_Path.AppendPoint(CFX_PointF(1, 2), FXPT_TYPE::MoveTo, false); pPathObj->m_Path.AppendPoint(CFX_PointF(3, 4), FXPT_TYPE::LineTo, false); pPathObj->m_Path.AppendPoint(CFX_PointF(5, 6), FXPT_TYPE::LineTo, true); @@ -170,7 +170,7 @@ TEST_F(CPDF_PageContentGeneratorTest, ProcessStandardText) { CPDF_Dictionary* pPageDict = pDoc->CreateNewPage(0); auto pTestPage = pdfium::MakeRetain(pDoc.get(), pPageDict, false); CPDF_PageContentGenerator generator(pTestPage.Get()); - auto pTextObj = pdfium::MakeUnique(); + auto pTextObj = pdfium::MakeUnique(-1); CPDF_Font* pFont = CPDF_Font::GetStockFont(pDoc.get(), "Times-Roman"); pTextObj->m_TextState.SetFont(pFont); pTextObj->m_TextState.SetFontSize(10.0f); @@ -237,7 +237,7 @@ TEST_F(CPDF_PageContentGeneratorTest, ProcessText) { std::ostringstream buf; { // Set the text object font and text - auto pTextObj = pdfium::MakeUnique(); + auto pTextObj = pdfium::MakeUnique(-1); CPDF_Dictionary* pDict = pDoc->NewIndirect(); pDict->SetNewFor("Type", "Font"); pDict->SetNewFor("Subtype", "TrueType"); diff --git a/core/fpdfapi/page/cpdf_contentparser.cpp b/core/fpdfapi/page/cpdf_contentparser.cpp index 9e8f70ef18..c74a889ff6 100644 --- a/core/fpdfapi/page/cpdf_contentparser.cpp +++ b/core/fpdfapi/page/cpdf_contentparser.cpp @@ -168,7 +168,7 @@ CPDF_ContentParser::Stage CPDF_ContentParser::Parse() { m_CurrentOffset += m_pParser->Parse( m_StreamArray[m_CurrentStream]->GetData() + m_CurrentOffset, m_StreamArray[m_CurrentStream]->GetSize() - m_CurrentOffset, - PARSE_STEP_LIMIT); + PARSE_STEP_LIMIT, m_CurrentStream); if (m_CurrentOffset >= m_StreamArray[m_CurrentStream]->GetSize()) { m_CurrentOffset = 0; diff --git a/core/fpdfapi/page/cpdf_formobject.cpp b/core/fpdfapi/page/cpdf_formobject.cpp index eca92ca0ff..22ac0d3823 100644 --- a/core/fpdfapi/page/cpdf_formobject.cpp +++ b/core/fpdfapi/page/cpdf_formobject.cpp @@ -10,9 +10,12 @@ #include "core/fpdfapi/page/cpdf_form.h" -CPDF_FormObject::CPDF_FormObject(std::unique_ptr pForm, +CPDF_FormObject::CPDF_FormObject(int32_t content_stream, + std::unique_ptr pForm, const CFX_Matrix& matrix) - : m_pForm(std::move(pForm)), m_FormMatrix(matrix) {} + : CPDF_PageObject(content_stream), + m_pForm(std::move(pForm)), + m_FormMatrix(matrix) {} CPDF_FormObject::~CPDF_FormObject() {} diff --git a/core/fpdfapi/page/cpdf_formobject.h b/core/fpdfapi/page/cpdf_formobject.h index c723cc0eaf..b229dce444 100644 --- a/core/fpdfapi/page/cpdf_formobject.h +++ b/core/fpdfapi/page/cpdf_formobject.h @@ -16,7 +16,9 @@ class CPDF_Form; class CPDF_FormObject : public CPDF_PageObject { public: - CPDF_FormObject(std::unique_ptr pForm, const CFX_Matrix& matrix); + CPDF_FormObject(int32_t content_stream, + std::unique_ptr pForm, + const CFX_Matrix& matrix); ~CPDF_FormObject() override; // CPDF_PageObject: diff --git a/core/fpdfapi/page/cpdf_imageobject.cpp b/core/fpdfapi/page/cpdf_imageobject.cpp index 3b5a740155..7826742276 100644 --- a/core/fpdfapi/page/cpdf_imageobject.cpp +++ b/core/fpdfapi/page/cpdf_imageobject.cpp @@ -12,7 +12,8 @@ #include "core/fpdfapi/page/cpdf_image.h" #include "core/fpdfapi/parser/cpdf_document.h" -CPDF_ImageObject::CPDF_ImageObject() {} +CPDF_ImageObject::CPDF_ImageObject(int32_t content_stream) + : CPDF_PageObject(content_stream) {} CPDF_ImageObject::~CPDF_ImageObject() { MaybePurgeCache(); diff --git a/core/fpdfapi/page/cpdf_imageobject.h b/core/fpdfapi/page/cpdf_imageobject.h index 16a506e537..465b1628ed 100644 --- a/core/fpdfapi/page/cpdf_imageobject.h +++ b/core/fpdfapi/page/cpdf_imageobject.h @@ -16,7 +16,7 @@ class CPDF_Image; class CPDF_ImageObject : public CPDF_PageObject { public: - CPDF_ImageObject(); + explicit CPDF_ImageObject(int32_t content_stream); ~CPDF_ImageObject() override; // CPDF_PageObject diff --git a/core/fpdfapi/page/cpdf_pageobject.cpp b/core/fpdfapi/page/cpdf_pageobject.cpp index 8bb5bf5978..582b9fff57 100644 --- a/core/fpdfapi/page/cpdf_pageobject.cpp +++ b/core/fpdfapi/page/cpdf_pageobject.cpp @@ -6,7 +6,8 @@ #include "core/fpdfapi/page/cpdf_pageobject.h" -CPDF_PageObject::CPDF_PageObject() : m_bDirty(false) {} +CPDF_PageObject::CPDF_PageObject(int32_t content_stream) + : m_bDirty(false), m_ContentStream(content_stream) {} CPDF_PageObject::~CPDF_PageObject() {} diff --git a/core/fpdfapi/page/cpdf_pageobject.h b/core/fpdfapi/page/cpdf_pageobject.h index d23cd971f8..b7cc5996c9 100644 --- a/core/fpdfapi/page/cpdf_pageobject.h +++ b/core/fpdfapi/page/cpdf_pageobject.h @@ -28,7 +28,7 @@ class CPDF_PageObject : public CPDF_GraphicStates { FORM, }; - CPDF_PageObject(); + explicit CPDF_PageObject(int32_t content_stream); ~CPDF_PageObject() override; virtual Type GetType() const = 0; @@ -58,6 +58,7 @@ class CPDF_PageObject : public CPDF_GraphicStates { return CFX_FloatRect(m_Left, m_Bottom, m_Right, m_Top); } FX_RECT GetBBox(const CFX_Matrix* pMatrix) const; + int32_t GetContentStream() const { return m_ContentStream; } float m_Left; float m_Right; @@ -73,6 +74,7 @@ class CPDF_PageObject : public CPDF_GraphicStates { void operator=(const CPDF_PageObject& src) = delete; bool m_bDirty; + int32_t m_ContentStream; }; #endif // CORE_FPDFAPI_PAGE_CPDF_PAGEOBJECT_H_ diff --git a/core/fpdfapi/page/cpdf_pathobject.cpp b/core/fpdfapi/page/cpdf_pathobject.cpp index d8c2cb8741..39ab134c92 100644 --- a/core/fpdfapi/page/cpdf_pathobject.cpp +++ b/core/fpdfapi/page/cpdf_pathobject.cpp @@ -6,7 +6,8 @@ #include "core/fpdfapi/page/cpdf_pathobject.h" -CPDF_PathObject::CPDF_PathObject() : m_FillType(0), m_bStroke(false) {} +CPDF_PathObject::CPDF_PathObject(int32_t content_stream) + : CPDF_PageObject(content_stream), m_FillType(0), m_bStroke(false) {} CPDF_PathObject::~CPDF_PathObject() {} diff --git a/core/fpdfapi/page/cpdf_pathobject.h b/core/fpdfapi/page/cpdf_pathobject.h index 58499b5a53..d4843d2fb6 100644 --- a/core/fpdfapi/page/cpdf_pathobject.h +++ b/core/fpdfapi/page/cpdf_pathobject.h @@ -14,7 +14,7 @@ class CPDF_PathObject : public CPDF_PageObject { public: - CPDF_PathObject(); + explicit CPDF_PathObject(int32_t content_stream); ~CPDF_PathObject() override; // CPDF_PageObject diff --git a/core/fpdfapi/page/cpdf_shadingobject.cpp b/core/fpdfapi/page/cpdf_shadingobject.cpp index 1b16ac4862..725e2e4591 100644 --- a/core/fpdfapi/page/cpdf_shadingobject.cpp +++ b/core/fpdfapi/page/cpdf_shadingobject.cpp @@ -9,9 +9,10 @@ #include "core/fpdfapi/page/cpdf_shadingpattern.h" #include "core/fpdfapi/parser/cpdf_document.h" -CPDF_ShadingObject::CPDF_ShadingObject(CPDF_ShadingPattern* pattern, +CPDF_ShadingObject::CPDF_ShadingObject(int32_t content_stream, + CPDF_ShadingPattern* pattern, const CFX_Matrix& matrix) - : m_pShading(pattern), m_Matrix(matrix) {} + : CPDF_PageObject(content_stream), m_pShading(pattern), m_Matrix(matrix) {} CPDF_ShadingObject::~CPDF_ShadingObject() {} diff --git a/core/fpdfapi/page/cpdf_shadingobject.h b/core/fpdfapi/page/cpdf_shadingobject.h index 80e062c729..69b606749d 100644 --- a/core/fpdfapi/page/cpdf_shadingobject.h +++ b/core/fpdfapi/page/cpdf_shadingobject.h @@ -15,7 +15,9 @@ class CPDF_ShadingPattern; class CPDF_ShadingObject : public CPDF_PageObject { public: - CPDF_ShadingObject(CPDF_ShadingPattern* pattern, const CFX_Matrix& matrix); + CPDF_ShadingObject(int32_t content_stream, + CPDF_ShadingPattern* pattern, + const CFX_Matrix& matrix); ~CPDF_ShadingObject() override; // CPDF_PageObject: diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.cpp b/core/fpdfapi/page/cpdf_streamcontentparser.cpp index 7e7c337d96..051d79ad1d 100644 --- a/core/fpdfapi/page/cpdf_streamcontentparser.cpp +++ b/core/fpdfapi/page/cpdf_streamcontentparser.cpp @@ -786,7 +786,8 @@ void CPDF_StreamContentParser::AddForm(CPDF_Stream* pStream) { CFX_Matrix matrix = m_pCurStates->m_CTM; matrix.Concat(m_mtContentToUser); - auto pFormObj = pdfium::MakeUnique(std::move(form), matrix); + auto pFormObj = pdfium::MakeUnique(m_CurrentContentStream, + std::move(form), matrix); if (!m_pObjectHolder->BackgroundAlphaNeeded() && pFormObj->form()->BackgroundAlphaNeeded()) { m_pObjectHolder->SetBackgroundAlphaNeeded(true); @@ -801,14 +802,14 @@ CPDF_ImageObject* CPDF_StreamContentParser::AddImage( if (!pStream) return nullptr; - auto pImageObj = pdfium::MakeUnique(); + auto pImageObj = pdfium::MakeUnique(m_CurrentContentStream); pImageObj->SetImage( pdfium::MakeRetain(m_pDocument.Get(), std::move(pStream))); return AddImageObject(std::move(pImageObj)); } CPDF_ImageObject* CPDF_StreamContentParser::AddImage(uint32_t streamObjNum) { - auto pImageObj = pdfium::MakeUnique(); + auto pImageObj = pdfium::MakeUnique(m_CurrentContentStream); pImageObj->SetImage(m_pDocument->LoadImageFromPageData(streamObjNum)); return AddImageObject(std::move(pImageObj)); } @@ -818,7 +819,7 @@ CPDF_ImageObject* CPDF_StreamContentParser::AddImage( if (!pImage) return nullptr; - auto pImageObj = pdfium::MakeUnique(); + auto pImageObj = pdfium::MakeUnique(m_CurrentContentStream); pImageObj->SetImage( m_pDocument->GetPageData()->GetImage(pImage->GetStream()->GetObjNum())); @@ -1085,7 +1086,8 @@ void CPDF_StreamContentParser::Handle_ShadeFill() { CFX_Matrix matrix = m_pCurStates->m_CTM; matrix.Concat(m_mtContentToUser); - auto pObj = pdfium::MakeUnique(pShading, matrix); + auto pObj = pdfium::MakeUnique(m_CurrentContentStream, + pShading, matrix); SetGraphicStates(pObj.get(), false, false, false); CFX_FloatRect bbox = pObj->m_ClipPath.HasRef() ? pObj->m_ClipPath.GetClipBox() : m_BBox; @@ -1220,7 +1222,7 @@ void CPDF_StreamContentParser::AddTextObject(ByteString* pStrs, pFont->IsType3Font() ? TextRenderingMode::MODE_FILL : m_pCurStates->m_TextState.GetTextMode(); { - auto pText = pdfium::MakeUnique(); + auto pText = pdfium::MakeUnique(m_CurrentContentStream); m_pLastTextObject = pText.get(); SetGraphicStates(m_pLastTextObject.Get(), true, true, true); if (TextRenderingModeIsStrokeMode(text_mode)) { @@ -1457,7 +1459,7 @@ void CPDF_StreamContentParser::AddPathObject(int FillType, bool bStroke) { CFX_Matrix matrix = m_pCurStates->m_CTM; matrix.Concat(m_mtContentToUser); if (bStroke || FillType) { - auto pPathObj = pdfium::MakeUnique(); + auto pPathObj = pdfium::MakeUnique(m_CurrentContentStream); pPathObj->m_bStroke = bStroke; pPathObj->m_FillType = FillType; pPathObj->m_Path = Path; @@ -1477,7 +1479,10 @@ void CPDF_StreamContentParser::AddPathObject(int FillType, bool bStroke) { uint32_t CPDF_StreamContentParser::Parse(const uint8_t* pData, uint32_t dwSize, - uint32_t max_cost) { + uint32_t max_cost, + uint32_t content_stream) { + m_CurrentContentStream = content_stream; + if (m_ParsedSet->size() > kMaxFormLevel || pdfium::ContainsKey(*m_ParsedSet, pData)) return dwSize; diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.h b/core/fpdfapi/page/cpdf_streamcontentparser.h index 438be024cc..4c593998fd 100644 --- a/core/fpdfapi/page/cpdf_streamcontentparser.h +++ b/core/fpdfapi/page/cpdf_streamcontentparser.h @@ -43,7 +43,10 @@ class CPDF_StreamContentParser { std::set* parsedSet); ~CPDF_StreamContentParser(); - uint32_t Parse(const uint8_t* pData, uint32_t dwSize, uint32_t max_cost); + uint32_t Parse(const uint8_t* pData, + uint32_t dwSize, + uint32_t max_cost, + uint32_t content_stream); CPDF_PageObjectHolder* GetPageObjectHolder() const { return m_pObjectHolder.Get(); } @@ -230,6 +233,7 @@ class CPDF_StreamContentParser { std::vector> m_StateStack; float m_Type3Data[6]; ContentParam m_ParamBuf[kParamBufSize]; + uint32_t m_CurrentContentStream; }; #endif // CORE_FPDFAPI_PAGE_CPDF_STREAMCONTENTPARSER_H_ diff --git a/core/fpdfapi/page/cpdf_textobject.cpp b/core/fpdfapi/page/cpdf_textobject.cpp index 36a4722773..68d20b6598 100644 --- a/core/fpdfapi/page/cpdf_textobject.cpp +++ b/core/fpdfapi/page/cpdf_textobject.cpp @@ -18,7 +18,8 @@ CPDF_TextObjectItem::CPDF_TextObjectItem() : m_CharCode(0) {} CPDF_TextObjectItem::~CPDF_TextObjectItem() = default; -CPDF_TextObject::CPDF_TextObject() {} +CPDF_TextObject::CPDF_TextObject(int32_t content_stream) + : CPDF_PageObject(content_stream) {} CPDF_TextObject::~CPDF_TextObject() { // Move m_CharCodes to a local variable so it will be captured in crash dumps, @@ -100,7 +101,7 @@ void CPDF_TextObject::GetCharInfo(size_t index, } std::unique_ptr CPDF_TextObject::Clone() const { - auto obj = pdfium::MakeUnique(); + auto obj = pdfium::MakeUnique(-1); obj->CopyData(this); obj->m_CharCodes = m_CharCodes; obj->m_CharPos = m_CharPos; diff --git a/core/fpdfapi/page/cpdf_textobject.h b/core/fpdfapi/page/cpdf_textobject.h index a6fc62369c..3faccfdfe7 100644 --- a/core/fpdfapi/page/cpdf_textobject.h +++ b/core/fpdfapi/page/cpdf_textobject.h @@ -25,7 +25,7 @@ class CPDF_TextObjectItem { class CPDF_TextObject : public CPDF_PageObject { public: - CPDF_TextObject(); + explicit CPDF_TextObject(int32_t content_stream); ~CPDF_TextObject() override; // CPDF_PageObject diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp index af976903be..9295b0e77f 100644 --- a/core/fpdfapi/render/cpdf_renderstatus.cpp +++ b/core/fpdfapi/render/cpdf_renderstatus.cpp @@ -1990,7 +1990,7 @@ void CPDF_RenderStatus::DrawTextPathWithPattern(const CPDF_TextObject* textobj, bool bFill, bool bStroke) { if (!bStroke) { - CPDF_PathObject path; + CPDF_PathObject path(-1); std::vector> pCopy; pCopy.push_back(std::unique_ptr(textobj->Clone())); path.m_bStroke = false; @@ -2019,7 +2019,7 @@ void CPDF_RenderStatus::DrawTextPathWithPattern(const CPDF_TextObject* textobj, if (!pPath) continue; - CPDF_PathObject path; + CPDF_PathObject path(-1); path.m_GraphState = textobj->m_GraphState; path.m_ColorState = textobj->m_ColorState; diff --git a/fpdfsdk/fpdf_editimg.cpp b/fpdfsdk/fpdf_editimg.cpp index fed1581e2d..0e95add851 100644 --- a/fpdfsdk/fpdf_editimg.cpp +++ b/fpdfsdk/fpdf_editimg.cpp @@ -87,7 +87,7 @@ FPDFPageObj_NewImageObj(FPDF_DOCUMENT document) { if (!pDoc) return nullptr; - auto pImageObj = pdfium::MakeUnique(); + auto pImageObj = pdfium::MakeUnique(-1); pImageObj->SetImage(pdfium::MakeRetain(pDoc)); // Caller takes ownership. diff --git a/fpdfsdk/fpdf_editpath.cpp b/fpdfsdk/fpdf_editpath.cpp index 70a558d2f1..102292eb3f 100644 --- a/fpdfsdk/fpdf_editpath.cpp +++ b/fpdfsdk/fpdf_editpath.cpp @@ -46,7 +46,7 @@ CPDF_PathObject* CPDFPathObjectFromFPDFPageObject(FPDF_PAGEOBJECT page_object) { FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV FPDFPageObj_CreateNewPath(float x, float y) { - auto pPathObj = pdfium::MakeUnique(); + auto pPathObj = pdfium::MakeUnique(-1); pPathObj->m_Path.AppendPoint(CFX_PointF(x, y), FXPT_TYPE::MoveTo, false); pPathObj->DefaultStates(); @@ -58,7 +58,7 @@ FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV FPDFPageObj_CreateNewRect(float x, float y, float w, float h) { - auto pPathObj = pdfium::MakeUnique(); + auto pPathObj = pdfium::MakeUnique(-1); pPathObj->m_Path.AppendRect(x, y, x + w, y + h); pPathObj->DefaultStates(); diff --git a/fpdfsdk/fpdf_edittext.cpp b/fpdfsdk/fpdf_edittext.cpp index 2996a505ee..66086d866c 100644 --- a/fpdfsdk/fpdf_edittext.cpp +++ b/fpdfsdk/fpdf_edittext.cpp @@ -412,7 +412,7 @@ FPDFPageObj_NewTextObj(FPDF_DOCUMENT document, if (!pFont) return nullptr; - auto pTextObj = pdfium::MakeUnique(); + auto pTextObj = pdfium::MakeUnique(-1); pTextObj->m_TextState.SetFont(pFont); pTextObj->m_TextState.SetFontSize(font_size); pTextObj->DefaultStates(); @@ -498,7 +498,7 @@ FPDFPageObj_CreateTextObj(FPDF_DOCUMENT document, if (!pDoc || !pFont) return nullptr; - auto pTextObj = pdfium::MakeUnique(); + auto pTextObj = pdfium::MakeUnique(-1); pTextObj->m_TextState.SetFont(pDoc->LoadFont(pFont->GetFontDict())); pTextObj->m_TextState.SetFontSize(font_size); pTextObj->DefaultStates(); -- cgit v1.2.3