source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: schwarze@mandoc.bsd.lv
To: source@mandoc.bsd.lv
Subject: mandoc: Correctly handle horizontal spans at the beginning of rows,
Date: Sat, 8 Jul 2017 08:43:46 -0500 (EST)	[thread overview]
Message-ID: <3103268943771550820.enqueue@fantadrom.bsd.lv> (raw)

Log Message:
-----------
Correctly handle horizontal spans at the beginning of rows,
fixing an assertion failure found by jsg@ with afl(1).

While here, also drop printing of whitespace in tbl_data()
which makes no difference because column positioning code
in term_tbl() already takes care of that.

Modified Files:
--------------
    mandoc:
        tbl_term.c

Revision Data
-------------
Index: tbl_term.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/tbl_term.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -Ltbl_term.c -Ltbl_term.c -u -p -r1.55 -r1.56
--- tbl_term.c
+++ tbl_term.c
@@ -170,7 +170,8 @@ term_tbl(struct termp *tp, const struct 
 			if (dp == NULL)
 				continue;
 			spans = dp->spans;
-			dp = dp->next;
+			if (ic || sp->layout->first->pos != TBL_CELL_SPAN)
+				dp = dp->next;
 		}
 
 		/* Set up a column for a right vertical frame. */
@@ -204,7 +205,8 @@ term_tbl(struct termp *tp, const struct 
 			if (dp == NULL)
 				continue;
 			spans = dp->spans;
-			dp = dp->next;
+			if (cp->pos != TBL_CELL_SPAN)
+				dp = dp->next;
 		}
 		break;
 	}
@@ -304,7 +306,9 @@ term_tbl(struct termp *tp, const struct 
 				}
 				if (dp != NULL) {
 					spans = dp->spans;
-					dp = dp->next;
+					if (ic || sp->layout->first->pos
+					    != TBL_CELL_SPAN)
+						dp = dp->next;
 				}
 
 				/*
@@ -514,14 +518,11 @@ tbl_data(struct termp *tp, const struct 
 		break;
 	}
 
-	if (dp == NULL) {
-		tbl_char(tp, ASCII_NBRSP, col->width);
+	if (dp == NULL)
 		return;
-	}
 
 	switch (dp->pos) {
 	case TBL_DATA_NONE:
-		tbl_char(tp, ASCII_NBRSP, col->width);
 		return;
 	case TBL_DATA_HORIZ:
 	case TBL_DATA_NHORIZ:
@@ -546,7 +547,7 @@ tbl_data(struct termp *tp, const struct 
 		tbl_number(tp, opts, dp, col);
 		break;
 	case TBL_CELL_DOWN:
-		tbl_char(tp, ASCII_NBRSP, col->width);
+	case TBL_CELL_SPAN:
 		break;
 	default:
 		abort();
--
 To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv

                 reply	other threads:[~2017-07-08 13:43 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=3103268943771550820.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).