diff options
author | 2017-02-11 15:44:11 +0000 | |
---|---|---|
committer | 2017-02-11 15:44:11 +0000 | |
commit | 86625c40e86a8e26babff7d0efcad70d03c7dee3 (patch) | |
tree | 1a4bf2d748a376f738a54fb696df7a71c5184b8f /usr.bin/mandoc/mdoc_macro.c | |
parent | Always leave one free slot in the Tx ring to avoid ambiguity with ring (diff) | |
download | wireguard-openbsd-86625c40e86a8e26babff7d0efcad70d03c7dee3.tar.xz wireguard-openbsd-86625c40e86a8e26babff7d0efcad70d03c7dee3.zip |
Never look for broken blocks inside blocks that are already closed.
Fixes the last the of tree corruptions sometimes causing NULL dereference
reported by tb@; this one triggered in cases like: .Bl -column .It Pq Ta
Diffstat (limited to 'usr.bin/mandoc/mdoc_macro.c')
-rw-r--r-- | usr.bin/mandoc/mdoc_macro.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/usr.bin/mandoc/mdoc_macro.c b/usr.bin/mandoc/mdoc_macro.c index 85457cff887..9676c7501da 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.171 2017/02/11 14:08:35 schwarze Exp $ */ +/* $OpenBSD: mdoc_macro.c,v 1.172 2017/02/11 15:44:11 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010, 2012-2016 Ingo Schwarze <schwarze@openbsd.org> @@ -398,6 +398,9 @@ find_pending(struct roff_man *mdoc, int tok, int line, int ppos, struct roff_node *n; int irc; + if (target->flags & NODE_VALID) + return 0; + irc = 0; for (n = mdoc->last; n != NULL && n != target; n = n->parent) { if (n->flags & NODE_ENDED) @@ -731,9 +734,7 @@ blk_exp_close(MACRO_PROT_ARGS) do target = target->parent; while ( ! (target->flags & NODE_ENDED)); - if ( ! (target->flags & NODE_VALID)) - pending = find_pending(mdoc, ntok, - line, ppos, target); + pending = find_pending(mdoc, ntok, line, ppos, target); } if ( ! pending) rew_pending(mdoc, n); |