diff options
author | Ken Sharp <ken.sharp@artifex.com> | 2022-12-08 14:52:51 +0000 |
---|---|---|
committer | Ken Sharp <ken.sharp@artifex.com> | 2022-12-08 14:52:51 +0000 |
commit | 58554d6dab83c7c94adfcc9a3285f647891a548f (patch) | |
tree | 9bcc6a4ae254868a826f3f2c42a88ffff2698eb2 /pdf/pdf_trans.c | |
parent | 3f70c043d9ec0cc8f61aeffba56adf10aabd6574 (diff) | |
download | ghostpdl-58554d6dab83c7c94adfcc9a3285f647891a548f.tar.gz |
GhostPDF - improve warnings when dealing with XObjects
Test file Bug688485.pdf
If a SMask is missing the Group (/G) raise an error rather than
a dmprintf.
Same for a missing or unrecognised Subtype (/S)
And for XObjects with the /PS (PostScript) subtype.
Errors and warnings are preferred to printf because we only report them
once at the end rather than on each occurrence which can be annoyingly
verbose.
Diffstat (limited to 'pdf/pdf_trans.c')
-rw-r--r-- | pdf/pdf_trans.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/pdf/pdf_trans.c b/pdf/pdf_trans.c index ab610ff3c..f04163dd6 100644 --- a/pdf/pdf_trans.c +++ b/pdf/pdf_trans.c @@ -144,7 +144,11 @@ static int pdfi_trans_set_mask(pdf_context *ctx, pdfi_int_gstate *igs, int color if (code <= 0) { dmprintf(ctx->memory, "WARNING: Missing 'G' in SMask, ignoring.\n"); pdfi_trans_end_smask_notify(ctx); - code = 0; + if (ctx->args.pdfstoponerror) + code = gs_note_error(gs_error_undefined); + else + code = 0; + pdfi_set_error(ctx, 0, NULL, E_PDF_SMASK_MISSING_G, "pdfi_trans_set_mask", ""); goto exit; } @@ -157,6 +161,7 @@ static int pdfi_trans_set_mask(pdf_context *ctx, pdfi_int_gstate *igs, int color if (code <= 0) { dmprintf(ctx->memory, "WARNING: Missing 'S' in SMask (defaulting to Luminosity)\n"); subtype = TRANSPARENCY_MASK_Luminosity; + pdfi_set_warning(ctx, 0, NULL, W_PDF_SMASK_MISSING_S, "pdfi_trans_set_mask", ""); } else if (pdfi_name_is(S, "Luminosity")) { subtype = TRANSPARENCY_MASK_Luminosity; @@ -165,6 +170,7 @@ static int pdfi_trans_set_mask(pdf_context *ctx, pdfi_int_gstate *igs, int color } else { dmprintf(ctx->memory, "WARNING: Unknown subtype 'S' in SMask (defaulting to Luminosity)\n"); subtype = TRANSPARENCY_MASK_Luminosity; + pdfi_set_warning(ctx, 0, NULL, W_PDF_SMASK_UNKNOWN_S, "pdfi_trans_set_mask", ""); } /* TR is transfer function (Optional) */ |