From db57abddea61d27902926e8bc578816ece975d27 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Wed, 29 Apr 2015 14:48:53 +0000 Subject: Do not mark a block with the MDOC_BROKEN flag if it merely contains a mismatching explicit end macro without actually being broken. Avoids a subsequent upward search for the non-existent breaker ending up in a NULL pointer access; afl test case 005/Apr27 from jsg@. --- mdoc_macro.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mdoc_macro.c b/mdoc_macro.c index 115fefe8..0ac00cd8 100644 --- a/mdoc_macro.c +++ b/mdoc_macro.c @@ -644,6 +644,8 @@ blk_exp_close(MACRO_PROT_ARGS) if (body == NULL) { mandoc_msg(MANDOCERR_BLK_NOTOPEN, mdoc->parse, line, ppos, mdoc_macronames[tok]); + if (later != NULL) + later->flags &= ~MDOC_BROKEN; if (maxargs && endbody == NULL) { /* * Stray .Ec without previous .Eo: -- cgit