source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: If a .Bd display is on the one hand doomed to be deleted because
@ 2016-08-11 10:47 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2016-08-11 10:47 UTC (permalink / raw)
  To: source

Log Message:
-----------
If a .Bd display is on the one hand doomed to be deleted because 
it has no type, but is on the other hand breaking another block,
delete its end marker as well, or the end marker may remain behind
as an orphan, triggering an assertion in the terminal formatter.
Problem found by tb@ with afl(1).

Modified Files:
--------------
    mdocml:
        mdoc_validate.c

Revision Data
-------------
Index: mdoc_validate.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mdoc_validate.c,v
retrieving revision 1.305
retrieving revision 1.306
diff -Lmdoc_validate.c -Lmdoc_validate.c -u -p -r1.305 -r1.306
--- mdoc_validate.c
+++ mdoc_validate.c
@@ -886,9 +886,10 @@ post_display(POST_ARGS)
 	n = mdoc->last;
 	switch (n->type) {
 	case ROFFT_BODY:
-		if (n->end != ENDBODY_NOT)
-			break;
-		if (n->child == NULL)
+		if (n->end != ENDBODY_NOT) {
+			if (n->tok == MDOC_Bd && n->parent->args == NULL)
+				roff_node_delete(mdoc, n);
+		} else if (n->child == NULL)
 			mandoc_msg(MANDOCERR_BLK_EMPTY, mdoc->parse,
 			    n->line, n->pos, mdoc_macronames[n->tok]);
 		else if (n->tok == MDOC_D1)
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

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

only message in thread, other threads:[~2016-08-11 10:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-11 10:47 mdocml: If a .Bd display is on the one hand doomed to be deleted because 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).