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 | 9ef0c733fd442e250894494f24d6a17d1db58500 (patch) | |
tree | 402b7c09964a3e420e105d5d76f1d2a343a7a140 | |
parent | b261141301b271a8279ceab15f6ec4c18dec7cd5 (diff) | |
download | mandoc-9ef0c733fd442e250894494f24d6a17d1db58500.tar.gz mandoc-9ef0c733fd442e250894494f24d6a17d1db58500.tar.zst mandoc-9ef0c733fd442e250894494f24d6a17d1db58500.zip |
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.
-rw-r--r-- | tbl_term.c | 19 |
1 files changed, 10 insertions, 9 deletions
@@ -1,4 +1,4 @@ -/* $Id: tbl_term.c,v 1.55 2017/06/27 18:25:02 schwarze Exp $ */ +/* $Id: tbl_term.c,v 1.56 2017/07/08 13:43:15 schwarze Exp $ */ /* * Copyright (c) 2009, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2011,2012,2014,2015,2017 Ingo Schwarze <schwarze@openbsd.org> @@ -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(); |