summaryrefslogtreecommitdiffstats
path: root/roff.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2019-12-26 19:51:51 +0000
committerIngo Schwarze <schwarze@openbsd.org>2019-12-26 19:51:51 +0000
commite3b08adce89f0d56af5c8c001beda568cf5e3456 (patch)
tree482adc9fd8c551622a5b3631c85932d74fa2399f /roff.c
parent7c71d25c0d707be901936bd815aa5f58780a2607 (diff)
downloadmandoc-e3b08adce89f0d56af5c8c001beda568cf5e3456.tar.gz
Do not fail an assertion when a high level macro occurs in the body
of a conditional inside a .ce request block. Instead, abort the .ce block just like when there is no conditional in between. Bug found by espie@ working on the textproc/fstrcmp port.
Diffstat (limited to 'roff.c')
-rw-r--r--roff.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/roff.c b/roff.c
index 149f2a12..e9ebdeba 100644
--- a/roff.c
+++ b/roff.c
@@ -2294,12 +2294,24 @@ roff_cond_sub(ROFF_ARGS)
}
}
+ t = roff_parse(r, buf->buf, &pos, ln, ppos);
+
+ /* For now, let high level macros abort .ce mode. */
+
+ if (roffce_node != NULL &&
+ (t == TOKEN_NONE || t == ROFF_Dd || t == ROFF_EQ ||
+ t == ROFF_TH || t == ROFF_TS)) {
+ r->man->last = roffce_node;
+ r->man->next = ROFF_NEXT_SIBLING;
+ roffce_lines = 0;
+ roffce_node = NULL;
+ }
+
/*
* Fully handle known macros when they are structurally
* required or when the conditional evaluated to true.
*/
- t = roff_parse(r, buf->buf, &pos, ln, ppos);
if (t == ROFF_break) {
if (irc & ROFF_LOOPMASK)
irc = ROFF_IGN | ROFF_LOOPEXIT;