summaryrefslogtreecommitdiffstats
path: root/usr.bin/mandoc/mdoc_macro.c
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2015-04-29 14:48:17 +0000
committerschwarze <schwarze@openbsd.org>2015-04-29 14:48:17 +0000
commitea701e045d0dc2d06177b40c5e50b6defafe424d (patch)
tree5c2ff47f8896def56c6e0c239c73b4e0cc459911 /usr.bin/mandoc/mdoc_macro.c
parentWhen the last line of a table layout turns out to be empty, it is deleted. (diff)
downloadwireguard-openbsd-ea701e045d0dc2d06177b40c5e50b6defafe424d.tar.xz
wireguard-openbsd-ea701e045d0dc2d06177b40c5e50b6defafe424d.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@.
Diffstat (limited to 'usr.bin/mandoc/mdoc_macro.c')
-rw-r--r--usr.bin/mandoc/mdoc_macro.c4
1 files changed, 3 insertions, 1 deletions
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 <kristaps@bsd.lv>
* Copyright (c) 2010, 2012-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -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: