tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: Ingo Schwarze <schwarze@usta.de>
To: "Anthony J. Bentley" <anthony@anjbe.name>
Cc: tech@mandoc.bsd.lv
Subject: Re: assertion "nit->head->child == NULL" failed
Date: Wed, 29 Nov 2017 21:17:28 +0100	[thread overview]
Message-ID: <20171129201728.GC15639@athene.usta.de> (raw)
In-Reply-To: <8495.1511344149@cathet.us>

Hi Anthony,

Anthony J. Bentley wrote on Wed, Nov 22, 2017 at 02:49:09AM -0700:

> .Dd
> .Bl -offset indent -column local
> .It x
> .El
> 
> (gdb) run tmp.d8X8GXiA24
> Starting program: /usr/bin/mandoc tmp.d8X8GXiA24
> assertion "nit->head->child == NULL" failed:
> file "mdoc_validate.c", line 1503, function "post_it"

Oops, i broke that quite some time ago when moving the validation
phase after the parsing phase.  Fixed by the commit below.

Thanks for reporting!
  Ingo


Log Message:
-----------
Recognize .Bl -column at parse time, and not only at validation time,
even if other arguments precede -column.  This is required because 
the .It parser needs to know whether or not we are a -column list.
Fixes tree corruption leading to an assertion failure.
Bug reported by bentley@.

Modified Files:
--------------
    mandoc:
        mdoc_state.c

Revision Data
-------------
Index: mdoc_state.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/mdoc_state.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -Lmdoc_state.c -Lmdoc_state.c -u -p -r1.8 -r1.9
--- mdoc_state.c
+++ mdoc_state.c
@@ -208,19 +208,24 @@ state_bd(STATE_ARGS)
 static void
 state_bl(STATE_ARGS)
 {
+	struct mdoc_arg	*args;
+	size_t		 i;
 
 	if (n->type != ROFFT_HEAD || n->parent->args == NULL)
 		return;
 
-	switch(n->parent->args->argv[0].arg) {
-	case MDOC_Diag:
-		n->norm->Bl.type = LIST_diag;
-		break;
-	case MDOC_Column:
-		n->norm->Bl.type = LIST_column;
-		break;
-	default:
-		break;
+	args = n->parent->args;
+	for (i = 0; i < args->argc; i++) {
+		switch(args->argv[i].arg) {
+		case MDOC_Diag:
+			n->norm->Bl.type = LIST_diag;
+			return;
+		case MDOC_Column:
+			n->norm->Bl.type = LIST_column;
+			return;
+		default:
+			break;
+		}
 	}
 }
 
--
 To unsubscribe send an email to tech+unsubscribe@mandoc.bsd.lv

      reply	other threads:[~2017-11-29 20:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-22  9:49 Anthony J. Bentley
2017-11-29 20:17 ` Ingo Schwarze [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171129201728.GC15639@athene.usta.de \
    --to=schwarze@usta.de \
    --cc=anthony@anjbe.name \
    --cc=tech@mandoc.bsd.lv \
    --subject='Re: assertion "nit->head->child == NULL" failed' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).