From b790074f54bc970c3e4ef82aad5e8ce6f7fba5b3 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Thu, 26 Dec 2019 19:51:51 +0000 Subject: 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. --- roff.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'roff.c') diff --git a/roff.c b/roff.c index ca53b5f9..427f62b5 100644 --- a/roff.c +++ b/roff.c @@ -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 * Copyright (c) 2010-2015, 2017-2019 Ingo Schwarze @@ -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; -- cgit v1.2.3-56-ge451