summaryrefslogtreecommitdiffstats
path: root/usr.bin/mandoc/mdoc_macro.c
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2014-12-22 23:26:20 +0000
committerschwarze <schwarze@openbsd.org>2014-12-22 23:26:20 +0000
commite0db1b2460109644752a76a4e1e6b33682ac94ad (patch)
treee8a4a2b0776f927c1307c11be33f3ac9fa2248fd /usr.bin/mandoc/mdoc_macro.c
parentClean up some weird spacing. No functional change. (diff)
downloadwireguard-openbsd-e0db1b2460109644752a76a4e1e6b33682ac94ad.tar.xz
wireguard-openbsd-e0db1b2460109644752a76a4e1e6b33682ac94ad.zip
The code already pays attention not to close the same block twice.
Similarly, avoid having the same block break two other blocks. In some situations, this could lead to an endless loop in rew_sub() found by jsg@ with afl. Minimal example: .Po Ao Pc Bo Pc Ac Bc
Diffstat (limited to 'usr.bin/mandoc/mdoc_macro.c')
-rw-r--r--usr.bin/mandoc/mdoc_macro.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/mandoc/mdoc_macro.c b/usr.bin/mandoc/mdoc_macro.c
index 14c686fdeb4..ec6507f01a5 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.116 2014/12/20 02:26:42 schwarze Exp $ */
+/* $OpenBSD: mdoc_macro.c,v 1.117 2014/12/22 23:26:20 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -361,7 +361,7 @@ rew_dohalt(enum mdoct tok, enum mdoc_type type,
* When starting to rewind, skip plain text
* and nodes that have already been rewound.
*/
- if (MDOC_TEXT == p->type || MDOC_VALID & p->flags)
+ if (p->type == MDOC_TEXT || p->flags & (MDOC_VALID | MDOC_BREAK))
return(REWIND_MORE);
/*
@@ -744,7 +744,7 @@ blk_exp_close(MACRO_PROT_ARGS)
atok = rew_alt(tok);
body = endbody = later = NULL;
for (n = mdoc->last; n; n = n->parent) {
- if (n->flags & MDOC_VALID)
+ if (n->flags & (MDOC_VALID | MDOC_BREAK))
continue;
/* Remember the start of our own body. */