diff options
author | tsepez <tsepez@chromium.org> | 2016-10-17 16:13:21 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-10-17 16:13:21 -0700 |
commit | 8021a646f18d76518be32c36907a04f213a0e21c (patch) | |
tree | 7b1ed0430a6686204b70f605daa976937607db31 /fpdfsdk | |
parent | c11287728d15bcc2c431f4b3c6eba8b5a79f906b (diff) | |
download | pdfium-8021a646f18d76518be32c36907a04f213a0e21c.tar.xz |
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
Diffstat (limited to 'fpdfsdk')
-rw-r--r-- | fpdfsdk/fpdfeditpage.cpp | 12 |
1 files 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 } } |