From: schwarze Date: Wed, 29 Apr 2015 14:48:17 +0000 (+0000) Subject: Do not mark a block with the MDOC_BROKEN flag if it merely contains X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=ea701e045d0dc2d06177b40c5e50b6defafe424d;p=openbsd 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@. --- diff --git a/usr.bin/mandoc/mdoc_macro.c b/usr.bin/mandoc/mdoc_macro.c index bfebe2c2e7c..76ff2722d3d 100644 --- a/usr.bin/mandoc/mdoc_macro.c +++ b/usr.bin/mandoc/mdoc_macro.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mdoc_macro.c,v 1.151 2015/04/23 15:35:39 schwarze Exp $ */ +/* $OpenBSD: mdoc_macro.c,v 1.152 2015/04/29 14:48:17 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010, 2012-2015 Ingo Schwarze @@ -642,6 +642,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: