From cbf3a1bbed373b9dad4816334fbff14b63672e94 Mon Sep 17 00:00:00 2001
From: "Sven M. Hallberg" <pesco@khjk.org>
Date: Tue, 28 Mar 2023 17:44:29 +0000
Subject: [PATCH] comments

---
 pdf.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/pdf.c b/pdf.c
index e8e3392..8ae9e48 100644
--- a/pdf.c
+++ b/pdf.c
@@ -4901,7 +4901,7 @@ parse_xrefs(struct Env *aux)
 	size_t offset = 0;
 
 	/* search for the "startxref" section from the back of the file */
-	HParser *p = h_left(p_startxref, h_end_p());
+	HParser *p = h_left(p_startxref, h_end_p());	// XXX alloc elsewhere?
 	for (size_t i = 0; i < sz; i++) {
 		res = h_parse(p, input + sz - i, i);
 		if (res != NULL)
@@ -4918,13 +4918,14 @@ parse_xrefs(struct Env *aux)
 	// e.g. offset bounds, /Prev type/value, loop detection
 
 	// verify the offset recovered is bounded to be in the file
+	// XXX this check is already present below by virtue of h_seek()
 	if ( (offset <=0) || (offset >= aux->sz) ) {
 		log_message(5, "VIOLATION[5]: Invalid xref table offset = %ld. Valid range <0, %ld>\n",
 				offset, aux->sz);
 		return;
 	}
 
-
+	// XXX try formulating this loop as one parser using h_seek and h_bind
 	for (;;) {
 		//res = h_parse(p_xref, input + offset, sz - offset);
 		HParser *p = h_right(h_seek(offset * 8, SEEK_SET), p_xref);
-- 
GitLab