diff options
Diffstat (limited to 'fpdfsdk')
-rw-r--r-- | fpdfsdk/fpdf_flatten.cpp | 1 | ||||
-rw-r--r-- | fpdfsdk/fpdf_flatten_embeddertest.cpp | 17 |
2 files changed, 18 insertions, 0 deletions
diff --git a/fpdfsdk/fpdf_flatten.cpp b/fpdfsdk/fpdf_flatten.cpp index 01f3cd7e1e..a27d79f09e 100644 --- a/fpdfsdk/fpdf_flatten.cpp +++ b/fpdfsdk/fpdf_flatten.cpp @@ -364,6 +364,7 @@ FPDF_EXPORT int FPDF_CALLCONV FPDFPage_Flatten(FPDF_PAGE page, int nFlag) { rcStream = pAPDic->GetRectFor("Rect"); else if (pAPDic->KeyExist("BBox")) rcStream = pAPDic->GetRectFor("BBox"); + rcStream.Normalize(); if (rcStream.IsEmpty()) continue; diff --git a/fpdfsdk/fpdf_flatten_embeddertest.cpp b/fpdfsdk/fpdf_flatten_embeddertest.cpp index a8915fe60c..c861d75711 100644 --- a/fpdfsdk/fpdf_flatten_embeddertest.cpp +++ b/fpdfsdk/fpdf_flatten_embeddertest.cpp @@ -37,3 +37,20 @@ TEST_F(FPDFFlattenEmbeddertest, FlatPrint) { EXPECT_EQ(FLATTEN_SUCCESS, FPDFPage_Flatten(page, FLAT_PRINT)); UnloadPage(page); } + +TEST_F(FPDFFlattenEmbeddertest, BUG_890322) { + static const char md5_hash[] = "6c674642154408e877d88c6c082d67e9"; + EXPECT_TRUE(OpenDocument("bug_890322.pdf")); + FPDF_PAGE page = LoadPage(0); + ASSERT_TRUE(page); + + ScopedFPDFBitmap bitmap = RenderLoadedPageWithFlags(page, FPDF_ANNOT); + CompareBitmap(bitmap.get(), 200, 200, md5_hash); + + EXPECT_EQ(FLATTEN_SUCCESS, FPDFPage_Flatten(page, FLAT_PRINT)); + EXPECT_TRUE(FPDF_SaveAsCopy(document(), this, 0)); + + UnloadPage(page); + + VerifySavedDocument(200, 200, md5_hash); +} |