aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2015-04-29 21:58:32 +0000
committerIngo Schwarze <schwarze@openbsd.org>2015-04-29 21:58:32 +0000
commit9164c82e687add97a231fc5a864f5c8f4a6cc381 (patch)
treeaddde107eeaae1d58a8ec6bc09455d4a424b3b11
parent5aae14345a405f370fc687547d918a084ce6e53f (diff)
downloadmandoc-9164c82e687add97a231fc5a864f5c8f4a6cc381.tar.gz
mandoc-9164c82e687add97a231fc5a864f5c8f4a6cc381.tar.zst
mandoc-9164c82e687add97a231fc5a864f5c8f4a6cc381.zip
If a block body gets broken, that's no good reason to extend the
scope of the end macro. Instead, only keep the tail scope open if the end macro macro calls an explicit macro and actually breaks that. This corrects syntax tree structure and fixes an assertion found by jsg@ with afl (test case 098/Apr27).
-rw-r--r--mdoc_macro.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/mdoc_macro.c b/mdoc_macro.c
index aafb4707..493ed8d0 100644
--- a/mdoc_macro.c
+++ b/mdoc_macro.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_macro.c,v 1.196 2015/04/29 14:48:53 schwarze Exp $ */
+/* $Id: mdoc_macro.c,v 1.197 2015/04/29 21:58:32 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -673,6 +673,8 @@ blk_exp_close(MACRO_PROT_ARGS)
if (endbody != NULL)
n = endbody;
+
+ ntok = TOKEN_NONE;
for (j = 0; ; j++) {
lastarg = *pos;
@@ -700,7 +702,7 @@ blk_exp_close(MACRO_PROT_ARGS)
}
if (n != NULL) {
- if (n != mdoc->last && n->flags & MDOC_BROKEN) {
+ if (ntok != TOKEN_NONE && n->flags & MDOC_BROKEN) {
target = n;
do
target = target->parent;