diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2017-07-08 13:43:15 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2017-07-08 13:43:15 +0000 |
commit | 244d91e692e1b324ecf144eb153c3ded672b57d1 (patch) | |
tree | 7b335e9c7711fd1f43f5955a84617a0c9c22ba0a /tbl_term.c | |
parent | 45fa6543a39f5c2b75536addb4794e1d29a27696 (diff) | |
download | mandoc-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.c | 17 |
1 files changed, 9 insertions, 8 deletions
@@ -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(); |