From 3cf6b568511139f44c0658a08187b5e077d70c65 Mon Sep 17 00:00:00 2001 From: "plvines (corpora)" <paul.vines@baesystems.com> Date: Sat, 15 Feb 2020 23:02:46 +0000 Subject: [PATCH] [REVIEW] Changed data-after-EOF rule to exclude gobbling another %%EOF. --- pdf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pdf.c b/pdf.c index 17793c3..c2c77fa 100644 --- a/pdf.c +++ b/pdf.c @@ -695,7 +695,7 @@ init_parser(struct Env *aux) CHX(VIOL(SEQ(nl, h_many1(nl), end), "(offset FROM END) Multiple newlines after final %%EOF (severity=4)"), SEQ(h_many(nl), end), - VIOL(SEQ(h_many1(h_ch_range(0, 255)), end), + VIOL(SEQ(h_butnot(h_ch_range(0, 255), LIT("%%EOF"))), "(offset FROM END) Data after final %%EOF (severity=7)")))); // XXX should lws be allowed before EOF marker? @@ -706,7 +706,8 @@ init_parser(struct Env *aux) "Uncommented junk after header (severity=1)")); H_RULE(tail, SEQ(body, h_optional(xr_td), startxr)); H_RULE(final_eof_junk, CHX(VIOL(SEQ(h_many1(nl), end), "Multiple newlines after final %%EOF (severity=4)"), - VIOL(h_many1(h_ch_range(0, 255)), "Data after final %%EOF (severity=7)"), + VIOL(h_many1(h_butnot(h_ch_range(0, 255), LIT("%%EOF"))), + "Data after final %%EOF (severity=7)"), end)); H_RULE(pdf, SEQ(header, OPT(hdr_junk), h_many1(tail), final_eof_junk)); -- GitLab