diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2019-12-26 19:51:51 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2019-12-26 19:51:51 +0000 |
commit | b790074f54bc970c3e4ef82aad5e8ce6f7fba5b3 (patch) | |
tree | 7aeae3022dc380cff49e6775aabc83f4864f738d /roff.c | |
parent | 9560859789a0ab85ae8d0a0a6cb58c2609c89663 (diff) | |
download | mandoc-b790074f54bc970c3e4ef82aad5e8ce6f7fba5b3.tar.gz mandoc-b790074f54bc970c3e4ef82aad5e8ce6f7fba5b3.tar.zst mandoc-b790074f54bc970c3e4ef82aad5e8ce6f7fba5b3.zip |
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.c | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -1,4 +1,4 @@ -/* $Id: roff.c,v 1.367 2019/11/09 14:39:49 schwarze Exp $ */ +/* $Id: roff.c,v 1.368 2019/12/26 19:51:51 schwarze Exp $ */ /* * Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2015, 2017-2019 Ingo Schwarze <schwarze@openbsd.org> @@ -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; |