From 8021a646f18d76518be32c36907a04f213a0e21c Mon Sep 17 00:00:00 2001 From: tsepez Date: Mon, 17 Oct 2016 16:13:21 -0700 Subject: FPDFPage_TransformAnnots(): don't re-insert unowned object on top of itself Underlying cause of the bug, unmasked when CPDF_Dictionary lost a redundancy check. BUG=656162 Review-Url: https://codereview.chromium.org/2425003002 --- fpdfsdk/fpdfeditpage.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/fpdfsdk/fpdfeditpage.cpp b/fpdfsdk/fpdfeditpage.cpp index 78790f7ce6..0b20a006a7 100644 --- a/fpdfsdk/fpdfeditpage.cpp +++ b/fpdfsdk/fpdfeditpage.cpp @@ -289,22 +289,22 @@ DLLEXPORT void STDCALL FPDFPage_TransformAnnots(FPDF_PAGE page, CPDF_AnnotList AnnotList(pPage); for (size_t i = 0; i < AnnotList.Count(); ++i) { CPDF_Annot* pAnnot = AnnotList.GetAt(i); - // transformAnnots Rectangle - CFX_FloatRect rect = pAnnot->GetRect(); + CFX_FloatRect rect = pAnnot->GetRect(); // transformAnnots Rectangle CFX_Matrix matrix((FX_FLOAT)a, (FX_FLOAT)b, (FX_FLOAT)c, (FX_FLOAT)d, (FX_FLOAT)e, (FX_FLOAT)f); rect.Transform(&matrix); + CPDF_Array* pRectArray = pAnnot->GetAnnotDict()->GetArrayFor("Rect"); - if (!pRectArray) + if (!pRectArray) { pRectArray = new CPDF_Array; + pAnnot->GetAnnotDict()->SetFor("Rect", pRectArray); + } pRectArray->SetAt(0, new CPDF_Number(rect.left)); pRectArray->SetAt(1, new CPDF_Number(rect.bottom)); pRectArray->SetAt(2, new CPDF_Number(rect.right)); pRectArray->SetAt(3, new CPDF_Number(rect.top)); - pAnnot->GetAnnotDict()->SetFor("Rect", pRectArray); - // Transform AP's rectangle - // To Do + // TODO: Transform AP's rectangle } } -- cgit v1.2.3