From 9249fd964637f75cc932e85dff83469ace3d9c6b Mon Sep 17 00:00:00 2001
From: "plvines (corpora)" <paul.vines@baesystems.com>
Date: Tue, 11 Feb 2020 20:42:10 +0000
Subject: [PATCH] Added gobbling anything but an objdef after the header

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

diff --git a/pdf.c b/pdf.c
index 9b58c23..edfb404 100644
--- a/pdf.c
+++ b/pdf.c
@@ -661,8 +661,9 @@ init_parser(struct Env *aux)
 		// NB: lws before xref offset is allowed, cf. p.48 (example 4)
 	H_RULE(xr_td,	SEQ(xrefs, KW("trailer"), ws, dict));
 
+	H_RULE(junk,    h_many1(h_butnot(h_ch_range(0, 255), objdef)));
 	H_RULE(tail,	SEQ(body, h_optional(xr_td), startxr));
-	H_RULE(pdf,	SEQ(header, h_many1(tail), end));
+	H_RULE(pdf,	SEQ(header, OPT(junk), h_many1(tail), end));
 
 	/* debug parser to consume as much as possible */
 	H_RULE(pdfdbg,	SEQ(header, h_many(tail), body, OPT(xr_td), OPT(startxr)));
-- 
GitLab