summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Sharp <ken.sharp@artifex.com>2022-09-14 16:07:18 +0100
committerChris Liddell <chris.liddell@artifex.com>2022-09-19 16:48:37 +0100
commitd690505fecbef8c28aa3a19a1932b05583e821d2 (patch)
tree8bf93976a7744117121d5dd4a359b42f27fdb17c
parent975a375753239d93b1b20bc1b241bdc5f294cab2 (diff)
downloadghostpdl-d690505fecbef8c28aa3a19a1932b05583e821d2.tar.gz
GhostPDF - fix Page count calculation
Commit 1bdc4a87930b1180cebaa73ea8a9cc96c50d34e9 added a check on the count of the number of pages (to try and avoid timeouts with OSS-fuzz and huge declared page counts). Unfortunately the wrong dictionary was queried for the count of intermediate page tree nodes leading to a wildly incorrect number of pages. This led to a load of errors being thrown, though all the pages were rendered correctly. Correct that here....
-rw-r--r--pdf/pdf_doc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/pdf/pdf_doc.c b/pdf/pdf_doc.c
index 6e236456a..7febe60ab 100644
--- a/pdf/pdf_doc.c
+++ b/pdf/pdf_doc.c
@@ -471,7 +471,7 @@ int pdfi_read_Pages(pdf_context *ctx)
pagecount++;
} else {
if (pdfi_name_is((pdf_name *)p1, "Pages")) {
- code = pdfi_dict_knownget(ctx, (pdf_dict *)o1, "Count", (pdf_obj **)&c);
+ code = pdfi_dict_knownget(ctx, (pdf_dict *)p, "Count", (pdf_obj **)&c);
if (code >= 0) {
if (pdfi_type_of(c) == PDF_INT)
pagecount += c->value.i;