From: Michael R Sweet <michael.r.sweet@gmail.com>
Date: Thu, 24 Mar 2022 16:30:07 -0400
Subject: CVE-2022-28085

Call check_pages when writing links (Issue #480)

Origin: upstream, https://github.com/michaelrsweet/htmldoc/commit/46c8ec2b9bccb8ccabff52d998c5eee77a228348
---
 htmldoc/ps-pdf.cxx | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/htmldoc/ps-pdf.cxx b/htmldoc/ps-pdf.cxx
index 7fbc345..8b1a45f 100644
--- a/htmldoc/ps-pdf.cxx
+++ b/htmldoc/ps-pdf.cxx
@@ -3578,6 +3578,8 @@ pdf_write_names(FILE *out)		/* I - Output file */
     pdf_start_object(out);
     float x, y;
 
+    check_pages(link->page);
+
     x = 0.0f;
     y = link->top + pages[link->page].bottom;
     pspdf_transform_coords(pages + link->page, x, y);
