summaryrefslogtreecommitdiff
path: root/devices
diff options
context:
space:
mode:
authorKen Sharp <ken.sharp@artifex.com>2022-11-15 15:21:15 +0000
committerKen Sharp <ken.sharp@artifex.com>2022-11-15 15:30:23 +0000
commitfcb6f1097b2a4a4141fcf78f9244654e83e6a734 (patch)
treedbe4edbdb75f47de3a4638943400ff19d11b5d3c /devices
parent9d0f7852205f9986ec39bfea63d4a006f7f46a31 (diff)
downloadghostpdl-fcb6f1097b2a4a4141fcf78f9244654e83e6a734.tar.gz
pdfwrite - fix page offset hints table for Linearized PDF
This started off with bug #706078, although the reporter did not specifically mention this problem, and pdfwrite has always had this bug, we'll fix it here. The linearisation code was not updating the usage record for the 'final' page in the output file. If that happened to be the only page then we could write an invalid number to the page offset hints table, claiming that the least number of objects on the page was 0, which it cannot be because we include the page object, so there must be at least 1 object.
Diffstat (limited to 'devices')
-rw-r--r--devices/vector/gdevpdf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/devices/vector/gdevpdf.c b/devices/vector/gdevpdf.c
index 40c2433b4..bdcd74f23 100644
--- a/devices/vector/gdevpdf.c
+++ b/devices/vector/gdevpdf.c
@@ -2137,7 +2137,7 @@ static int pdf_linearise(gx_device_pdf *pdev, pdf_linearisation_t *linear_params
/* If the final page makes marks but does not call showpage we don't emit it
* which can lead to references to non-existent pages.
*/
- if (page < pdev->next_page) {
+ if (page <= pdev->next_page) {
pagehint = &linear_params->PageHints[page - 1];
pagehint->NumUniqueObjects++;
if (record->LinearisedOffset - LinearisedPageOffset > pagehint->PageLength)