From 8b2bafbfa81945ef686da064d311fa1d66406214 Mon Sep 17 00:00:00 2001
From: "Sven M. Hallberg" <pesco@khjk.org>
Date: Tue, 28 Jan 2020 17:52:33 +0100
Subject: [PATCH] be more lenient with 0-width fields in xref streams

---
 pdf.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/pdf.c b/pdf.c
index 1ee027c..550f6ee 100644
--- a/pdf.c
+++ b/pdf.c
@@ -1146,11 +1146,18 @@ kxstream(HAllocator *mm__, const HParsedToken *x, void *env)
 		p_field[0] = p_return_1;	/* all type 1 */
 	if (W[2] == 0) {
 		p_field[2] = p_return_0;	/* all generation 0 */
+		#if 0
+		/* XXX
+		 * i've seen a 0-width field 3 used with values of 1 (inuse)
+		 * and 2 (objstm) in field 1, implying "objstm idx 0" for the
+		 * latter case.
+		 */
 		if (W[0] > 0) {
 			/* type field *must* be 1 */
 			p_field[0] = h_attr_bool__m(mm__, p_field[0],
 			    validate_eq_uint, (void *)1);
 		}
+		#endif
 	}
 	if (Wskip > 0)	// XXX h_skip does not work with CF, yet
 		goto fail;
-- 
GitLab