source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mandoc: Do not fail an assertion when a high level macro occurs in the
@ 2019-12-26 19:52 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2019-12-26 19:52 UTC (permalink / raw)
  To: source

Log Message:
-----------
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.

Modified Files:
--------------
    mandoc:
        roff.c

Revision Data
-------------
Index: roff.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/roff.c,v
retrieving revision 1.367
retrieving revision 1.368
diff -Lroff.c -Lroff.c -u -p -r1.367 -r1.368
--- roff.c
+++ 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;
--
 To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-12-26 19:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-26 19:52 mandoc: Do not fail an assertion when a high level macro occurs in the schwarze

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).