summaryrefslogtreecommitdiff
path: root/vcl/source/pdf
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2020-10-19 16:50:07 +0200
committerMiklos Vajna <vmiklos@collabora.com>2020-10-20 00:50:37 +0200
commit586f6abee92af3cdabdce034b607b9a046ed3946 (patch)
treea0b7dbed12b25caf4ef401d5d15a81ef928f3938 /vcl/source/pdf
parent326c8d06070a4a41a666db919702f7c423dc7a18 (diff)
xmlsecurity: handle MDP permission during PDF verify
Change-Id: I626fca7c03079fb0374c577dcfe024e7db6ed5b3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104529 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'vcl/source/pdf')
-rw-r--r--vcl/source/pdf/PDFiumLibrary.cxx12
1 files changed, 8 insertions, 4 deletions
diff --git a/vcl/source/pdf/PDFiumLibrary.cxx b/vcl/source/pdf/PDFiumLibrary.cxx
index 0b5114830c71..41e061bb1f6c 100644
--- a/vcl/source/pdf/PDFiumLibrary.cxx
+++ b/vcl/source/pdf/PDFiumLibrary.cxx
@@ -388,7 +388,7 @@ std::unique_ptr<PDFiumBitmap> PDFiumPageObject::getImageBitmap()
return pPDFiumBitmap;
}
-BitmapChecksum PDFiumPage::getChecksum()
+BitmapChecksum PDFiumPage::getChecksum(int nMDPPerm)
{
size_t nPageWidth = getWidth();
size_t nPageHeight = getHeight();
@@ -399,11 +399,15 @@ BitmapChecksum PDFiumPage::getChecksum()
return 0;
}
- // Intentionally not using FPDF_ANNOT here, annotations/commenting is OK to not affect the
- // checksum, signature verification wants this.
+ int nFlags = 0;
+ if (nMDPPerm != 3)
+ {
+ // Annotations/commenting should affect the checksum, signature verification wants this.
+ nFlags = FPDF_ANNOT;
+ }
FPDF_RenderPageBitmap(pPdfBitmap->getPointer(), mpPage, /*start_x=*/0, /*start_y=*/0,
nPageWidth, nPageHeight,
- /*rotate=*/0, /*flags=*/0);
+ /*rotate=*/0, nFlags);
Bitmap aBitmap(Size(nPageWidth, nPageHeight), 24);
{
BitmapScopedWriteAccess pWriteAccess(aBitmap);