source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mandoc: Correctly handle horizontal spans at the beginning of rows,
@ 2017-07-08 13:43 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2017-07-08 13:43 UTC (permalink / raw)
  To: source

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

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

only message in thread, other threads:[~2017-07-08 13:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-08 13:43 mandoc: Correctly handle horizontal spans at the beginning of rows, 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).