summaryrefslogtreecommitdiff
path: root/pdf/ghostpdf.c
diff options
context:
space:
mode:
authorKen Sharp <ken.sharp@artifex.com>2022-12-12 11:40:47 +0000
committerKen Sharp <ken.sharp@artifex.com>2022-12-12 11:40:47 +0000
commit3036b841bd960d7e5ee4e855821bef4ece1bdfb2 (patch)
treecfbae09cf2b41d8941b05410b393cf84edc20a1a /pdf/ghostpdf.c
parent5b9286df3cf7610ac27ee7bef07e272fdd94a02f (diff)
downloadghostpdl-3036b841bd960d7e5ee4e855821bef4ece1bdfb2.tar.gz
GhostPDF - add some warnings to approximate the old interpreter
If the %PDF-x.y version has non-white space characters between the minor version number and the EOL the old interpreter issued a warning, we now do similarly. If an annotation entry in the Page dictionary was not a dictionary the old interpreter raised a warning, we were silently ignoring it.
Diffstat (limited to 'pdf/ghostpdf.c')
-rw-r--r--pdf/ghostpdf.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/pdf/ghostpdf.c b/pdf/ghostpdf.c
index e6751155a..b9444cefc 100644
--- a/pdf/ghostpdf.c
+++ b/pdf/ghostpdf.c
@@ -1339,6 +1339,18 @@ int pdfi_set_input_stream(pdf_context *ctx, stream *stm)
}
else {
ctx->HeaderVersion = version;
+ s += 5;
+ while (((*s >= '0' && *s <= '9') || *s == '.') && *s != 0x00)
+ s++;
+ while (*s != 0x00) {
+ if (*s == 0x09 || *s== 0x0c || *s == 0x20) {
+ s++;
+ continue;
+ }
+ if (*s != 0x0A && *s != 0x0D)
+ pdfi_set_warning(ctx, 0, NULL, W_PDF_VERSION_NO_EOL, "pdfi_set_input_stream", (char *)"%% PDF version not immediately followed with EOL\n");
+ break;
+ }
}
if (ctx->args.pdfdebug)
dmprintf1(ctx->memory, "%% Found header, PDF version is %f\n", ctx->HeaderVersion);