From 6d9eab9bf47d5f1cc82a8f02257ea7a2911dcf79 Mon Sep 17 00:00:00 2001
From: "plvines (corpora)" <paul.vines@baesystems.com>
Date: Tue, 11 Feb 2020 21:58:16 +0000
Subject: [PATCH] Allows many newlines after %%EOF

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

diff --git a/pdf.c b/pdf.c
index e4ba283..df57b4d 100644
--- a/pdf.c
+++ b/pdf.c
@@ -656,13 +656,13 @@ init_parser(struct Env *aux)
 	/* trailer */
 	H_RULE(startxr,	SEQ(nl, KW("startxref"), nl,
 			    lws, nat, nl,
-			    LIT("%%EOF"), CHX(nl, end)));
 		// XXX the real world sometimes omits nl after %%EOF inside the file.
 		//     the next 'tail' would be appended right after the 'F',
 		//     presumably because the previous version of the file
 		//     ended without a trailing newline. m)
 		//     this is invalid per spec, because it creates a run-on 
 		//     comment, but we should probably accept-and-warn.
+			    LIT("%%EOF"), CHX(h_many(nl), end)));
 		// XXX should lws be allowed before EOF marker?
 		// NB: lws before xref offset is allowed, cf. p.48 (example 4)
 	H_RULE(xr_td,	SEQ(xrefs, KW("trailer"), ws, dict));
-- 
GitLab