diff options
author | Ken Sharp <ken.sharp@artifex.com> | 2012-03-13 09:37:15 +0000 |
---|---|---|
committer | Chris Liddell <chris.liddell@artifex.com> | 2012-03-15 11:54:25 +0000 |
commit | 6c911e4ae0638176172ddbc7d755ed102deaaafa (patch) | |
tree | 0676eaec1fa7adec4b63f4e55b2ea6beec302ce0 | |
parent | 5ef6b834ef7c5d03a482d0aa5df94b1f602be903 (diff) |
pdfwrite - correction to PDF/A processing
The previous commit for PDF/A prcoessing did not properly check the PDF/A
level in the PostScript handlers, and treated any setting as being PDF/A.
In fact only settings greater than 0 shuold be checked, 0 means 'not PDF/A'
Add code in gdev_pdf_put_params to ensure that PDFA has a permitted value
(0->2) and signal rangecheck if not.
No differences expected.
-rw-r--r-- | gs/Resource/Init/gs_cspace.ps | 2 | ||||
-rw-r--r-- | gs/Resource/Init/gs_pdfwr.ps | 2 | ||||
-rw-r--r-- | gs/base/gdevpdfp.c | 5 |
3 files changed, 7 insertions, 2 deletions
diff --git a/gs/Resource/Init/gs_cspace.ps b/gs/Resource/Init/gs_cspace.ps index 944410c78..7925ad7f3 100644 --- a/gs/Resource/Init/gs_cspace.ps +++ b/gs/Resource/Init/gs_cspace.ps @@ -165,7 +165,7 @@ bind def % /cs_substitute_DeviceRGB_for_PDFX_or_PDFA { systemdict /PDFX .knownget not { //false } if - systemdict /PDFA .knownget not { //false } {pop //true} ifelse + systemdict /PDFA .knownget not { //false } {0 eq {//false}{//true} ifelse} ifelse or { dup /ColorSpace resourcestatus { pop pop diff --git a/gs/Resource/Init/gs_pdfwr.ps b/gs/Resource/Init/gs_pdfwr.ps index dbdfe256e..9f97a9538 100644 --- a/gs/Resource/Init/gs_pdfwr.ps +++ b/gs/Resource/Init/gs_pdfwr.ps @@ -475,7 +475,7 @@ userdict /.pdfcvstring () put grestore } if dup /PS eq systemdict /PDFX .knownget not { //false } if - systemdict /PDFA .knownget not { //false }{pop //true} ifelse or and { + systemdict /PDFA .knownget not { //false }{0 eq {//false}{//true} ifelse} ifelse or and { % Execute it since PDF/X doesn't allow to embed it. pop { dup mark eq { diff --git a/gs/base/gdevpdfp.c b/gs/base/gdevpdfp.c index 6a397b5e0..fcc6d899e 100644 --- a/gs/base/gdevpdfp.c +++ b/gs/base/gdevpdfp.c @@ -416,6 +416,11 @@ gdev_pdf_put_params_impl(gx_device * dev, const gx_device_pdf * save_dev, gs_par * or less impossible to alter the setting in the (potentially saved) page * device dictionary, so we use this rather clunky method. */ + if (pdev->PDFA < 0 || pdev->PDFA > 2){ + ecode = gs_note_error(gs_error_rangecheck); + param_signal_error(plist, "PDFA", ecode); + goto fail; + } if(pdev->PDFA != 0 && pdev->AbortPDFAX) pdev->PDFA = 0; if(pdev->PDFX && pdev->AbortPDFAX) |