aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2015-04-29 14:48:53 +0000
committerIngo Schwarze <schwarze@openbsd.org>2015-04-29 14:48:53 +0000
commitbc2734def665102468b1f7b8f30738fd94f658a4 (patch)
tree91f0ce6774a65e797e3bcfe96bf32280d0798a58
parent0745d78af02f9484ee3018377936265fe41b4858 (diff)
downloadmandoc-bc2734def665102468b1f7b8f30738fd94f658a4.tar.gz
mandoc-bc2734def665102468b1f7b8f30738fd94f658a4.tar.zst
mandoc-bc2734def665102468b1f7b8f30738fd94f658a4.zip
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@.
-rw-r--r--mdoc_macro.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/mdoc_macro.c b/mdoc_macro.c
index 3e5667de..aafb4707 100644
--- a/mdoc_macro.c
+++ b/mdoc_macro.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_macro.c,v 1.195 2015/04/23 15:35:59 schwarze Exp $ */
+/* $Id: mdoc_macro.c,v 1.196 2015/04/29 14:48:53 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -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: