source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: schwarze@mandoc.bsd.lv
To: source@mandoc.bsd.lv
Subject: mandoc: fix incomplete handling of roff(7) nodes in man(7) block
Date: Wed, 28 Jun 2017 07:53:15 -0500 (EST)	[thread overview]
Message-ID: <4765525107544201796.enqueue@fantadrom.bsd.lv> (raw)

Log Message:
-----------
fix incomplete handling of roff(7) nodes in man(7) block next-line scope;
assertion failure in tclsh(1) reported by deraadt@ via bentley@

Modified Files:
--------------
    mandoc:
        man.c

Revision Data
-------------
Index: man.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/man.c,v
retrieving revision 1.175
retrieving revision 1.176
diff -Lman.c -Lman.c -u -p -r1.175 -r1.176
--- man.c
+++ man.c
@@ -282,8 +282,10 @@ man_breakscope(struct roff_man *man, int
 	if (man->flags & MAN_ELINE && (tok < MAN_TH ||
 	    ! (man_macros[tok].flags & MAN_NSCOPED))) {
 		n = man->last;
-		assert(n->type != ROFFT_TEXT);
-		if (man_macros[n->tok].flags & MAN_NSCOPED)
+		if (n->type == ROFFT_TEXT)
+			n = n->parent;
+		if (n->tok < MAN_TH ||
+		    man_macros[n->tok].flags & MAN_NSCOPED)
 			n = n->parent;
 
 		mandoc_vmsg(MANDOCERR_BLK_LINE, man->parse,
@@ -319,7 +321,8 @@ man_breakscope(struct roff_man *man, int
 		n = man->last;
 		if (n->type == ROFFT_TEXT)
 			n = n->parent;
-		if ( ! (man_macros[n->tok].flags & MAN_BSCOPE))
+		if (n->tok < MAN_TH ||
+		    (man_macros[n->tok].flags & MAN_BSCOPE) == 0)
 			n = n->parent;
 
 		assert(n->type == ROFFT_HEAD);
--
 To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv

                 reply	other threads:[~2017-06-28 12:53 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=4765525107544201796.enqueue@fantadrom.bsd.lv \
    --to=schwarze@mandoc.bsd.lv \
    --cc=source@mandoc.bsd.lv \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).