Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Unified Diff: fpdfsdk/fpdf_flatten.cpp

Issue 2489653003: Fix abort above FPDFPage_Flatten (Closed)
Patch Set: rebased Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « BUILD.gn ('k') | fpdfsdk/fpdf_flatten_embeddertest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/fpdf_flatten.cpp
diff --git a/fpdfsdk/fpdf_flatten.cpp b/fpdfsdk/fpdf_flatten.cpp
index f7d82773e1476e2bd88893dfa5f37642183a9dfe..6cffbe0b3120dd2490ff89fe41808711f2e701c3 100644
--- a/fpdfsdk/fpdf_flatten.cpp
+++ b/fpdfsdk/fpdf_flatten.cpp
@@ -397,8 +397,6 @@ DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag) {
continue;
CPDF_Dictionary* pAPDic = pAPStream->GetDict();
- CFX_Matrix matrix = pAPDic->GetMatrixFor("Matrix");
-
CFX_FloatRect rcStream;
if (pAPDic->KeyExist("Rect"))
rcStream = pAPDic->GetRectFor("Rect");
@@ -409,13 +407,15 @@ DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag) {
continue;
CPDF_Object* pObj = pAPStream;
+ if (pObj->IsInline()) {
+ pObj = pObj->Clone();
+ pDocument->AddIndirectObject(pObj);
+ }
- if (pObj) {
- CPDF_Dictionary* pObjDic = pObj->GetDict();
- if (pObjDic) {
- pObjDic->SetNameFor("Type", "XObject");
- pObjDic->SetNameFor("Subtype", "Form");
- }
+ CPDF_Dictionary* pObjDic = pObj->GetDict();
+ if (pObjDic) {
+ pObjDic->SetNameFor("Type", "XObject");
+ pObjDic->SetNameFor("Subtype", "Form");
}
CPDF_Dictionary* pXObject = pNewXORes->GetDictFor("XObject");
@@ -426,15 +426,14 @@ DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag) {
CFX_ByteString sFormName;
sFormName.Format("F%d", i);
- pXObject->SetReferenceFor(sFormName, pDocument,
- pDocument->AddIndirectObject(pObj));
+ pXObject->SetReferenceFor(sFormName, pDocument, pObj->GetObjNum());
CPDF_StreamAcc acc;
acc.LoadAllData(pNewXObject);
const uint8_t* pData = acc.GetData();
CFX_ByteString sStream(pData, acc.GetSize());
-
+ CFX_Matrix matrix = pAPDic->GetMatrixFor("Matrix");
if (matrix.IsIdentity()) {
matrix.a = 1.0f;
matrix.b = 0.0f;
« no previous file with comments | « BUILD.gn ('k') | fpdfsdk/fpdf_flatten_embeddertest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698