summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Sharp <ken.sharp@artifex.com>2021-04-11 13:14:28 +0100
committerKen Sharp <ken.sharp@artifex.com>2021-04-11 13:14:28 +0100
commit4a37fecd4e5006f9bac17f6ece4017144b2a5305 (patch)
tree7c790e4c68b5f1c6a9040399352f3c472cebbf33
parentc65cd9b752afe5da7d8b41ec1c4d87df746f45a7 (diff)
downloadghostpdl-4a37fecd4e5006f9bac17f6ece4017144b2a5305.tar.gz
Relax checking of Forms, assume Form XObject if in doubt.
Previously we had handled Form XObjects which were missing a Subtype by checking for a FormType, and only throwing an error if the FormType was also missing. It appears we have several files in the test suite where both keys are missing (!!) and Acrobat simply assumes these are Form XObjects. So here we relax the checking and assume that anything missing a Subtype is in fact a From XObject. Several files now work.
-rw-r--r--pdf/pdf_image.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/pdf/pdf_image.c b/pdf/pdf_image.c
index 81544afe8..6d6bb502e 100644
--- a/pdf/pdf_image.c
+++ b/pdf/pdf_image.c
@@ -2185,15 +2185,13 @@ int pdfi_do_image_or_form(pdf_context *ctx, pdf_dict *stream_dict,
code = pdfi_dict_get(ctx, xobject_dict, "Subtype", (pdf_obj **)&n);
if (code < 0) {
if (code == gs_error_undefined) {
- code = pdfi_dict_get(ctx, xobject_dict, "FormType", (pdf_obj **)&n);
- if (code >= 0) {
- pdfi_countdown(n);
- code = pdfi_name_alloc(ctx, (byte *)"Form", 4, (pdf_obj **)&n);
- pdfi_countup(n);
- ctx->pdf_errors |= E_PDF_NO_SUBTYPE;
- }
- else
- goto exit;
+ /* This is illegal, because we have no way to tell is an XObject is a Form
+ * or Image object. However it seems Acrobat just assumes that it's a Form!
+ * See test file /tests_private/pdf/PDFIA1.7_SUBSET/CATX2063.pdf
+ */
+ code = pdfi_name_alloc(ctx, (byte *)"Form", 4, (pdf_obj **)&n);
+ pdfi_countup(n);
+ ctx->pdf_errors |= E_PDF_NO_SUBTYPE;
}
else
goto exit;