summaryrefslogtreecommitdiffstats
path: root/tbl_term.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2017-07-08 13:43:15 +0000
committerIngo Schwarze <schwarze@openbsd.org>2017-07-08 13:43:15 +0000
commit244d91e692e1b324ecf144eb153c3ded672b57d1 (patch)
tree7b335e9c7711fd1f43f5955a84617a0c9c22ba0a /tbl_term.c
parent45fa6543a39f5c2b75536addb4794e1d29a27696 (diff)
downloadmandoc-244d91e692e1b324ecf144eb153c3ded672b57d1.tar.gz
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.
Diffstat (limited to 'tbl_term.c')
-rw-r--r--tbl_term.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/tbl_term.c b/tbl_term.c
index 8fc4bc8c..1d4b0389 100644
--- a/tbl_term.c
+++ b/tbl_term.c
@@ -170,7 +170,8 @@ term_tbl(struct termp *tp, const struct tbl_span *sp)
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 tbl_span *sp)
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 tbl_span *sp)
}
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 tbl_opts *opts,
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_opts *opts,
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();