summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2017-02-16 14:38:12 +0000
committerIngo Schwarze <schwarze@openbsd.org>2017-02-16 14:38:12 +0000
commitbbeb7f3d1552ab971dd625340d256ddad5e3dceb (patch)
tree5068aa8160413593e88d5e6f83f07b03890274ad
parent853da03c9620f7701e3a1286e9316ec6b8c23b2f (diff)
downloadmandoc-bbeb7f3d1552ab971dd625340d256ddad5e3dceb.tar.gz
Surprisingly, groff does not support scaling units in .Bl -column
column width specifiers, so stop supporting them, too. As a side effect, this fixes an assertion failure that tb@ found with afl(1), triggered by: .Bl -column -4n
-rw-r--r--NEWS2
-rw-r--r--mdoc.76
-rw-r--r--mdoc_term.c14
-rw-r--r--regress/mdoc/Bl/breakingTa.in2
4 files changed, 15 insertions, 9 deletions
diff --git a/NEWS b/NEWS
index 00011ccb..b50d75a6 100644
--- a/NEWS
+++ b/NEWS
@@ -65,6 +65,8 @@ Changes in version 1.14.1, released on February XXX, 2017
for empty matrices and empty square roots.
* mdoc(7): Fix an assertion failure for a .Bd without a type that
breaks another block.
+ * mdoc(7): Fix an assertion failure that happened for some .Bl -column
+ lists containing a column width of "-4n", "-3n", or "-2n".
* mdoc(7): Fix an assertion failure caused by .Bl -column without .It
but containing eqn(7) or tbl(7) code.
* roff(7): Fix an assertion failure caused by \z\[u00FF] with -Tps/-Tpdf.
diff --git a/mdoc.7 b/mdoc.7
index 8137f6b5..a9be2fca 100644
--- a/mdoc.7
+++ b/mdoc.7
@@ -974,10 +974,8 @@ argument.
A columnated list.
The
.Fl width
-argument has no effect; instead, each argument specifies the width
-of one column, using either the scaling width syntax described in
-.Xr roff 7
-or the string length of the argument.
+argument has no effect; instead, the string length of each argument
+specifies the width of one column.
If the first line of the body of a
.Fl column
list is not an
diff --git a/mdoc_term.c b/mdoc_term.c
index e0d2f4cc..71693c5c 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -606,6 +606,7 @@ termp_ll_pre(DECL_ARGS)
static int
termp_it_pre(DECL_ARGS)
{
+ struct roffsu su;
char buf[24];
const struct roff_node *bl, *nn;
size_t ncols, dcol;
@@ -683,9 +684,12 @@ termp_it_pre(DECL_ARGS)
for (i = 0, nn = n->prev;
nn->prev && i < (int)ncols;
- nn = nn->prev, i++)
- offset += dcol + a2width(p,
- bl->norm->Bl.cols[i]);
+ nn = nn->prev, i++) {
+ SCALE_HS_INIT(&su,
+ term_strlen(p, bl->norm->Bl.cols[i]));
+ su.scale /= term_strlen(p, "0");
+ offset += term_hspan(p, &su) / 24 + dcol;
+ }
/*
* When exceeding the declared number of columns, leave
@@ -700,7 +704,9 @@ termp_it_pre(DECL_ARGS)
* Use the declared column widths, extended as explained
* in the preceding paragraph.
*/
- width = a2width(p, bl->norm->Bl.cols[i]) + dcol;
+ SCALE_HS_INIT(&su, term_strlen(p, bl->norm->Bl.cols[i]));
+ su.scale /= term_strlen(p, "0");
+ width = term_hspan(p, &su) / 24 + dcol;
break;
default:
if (NULL == bl->norm->Bl.width)
diff --git a/regress/mdoc/Bl/breakingTa.in b/regress/mdoc/Bl/breakingTa.in
index ca8e5769..80192b6c 100644
--- a/regress/mdoc/Bl/breakingTa.in
+++ b/regress/mdoc/Bl/breakingTa.in
@@ -7,7 +7,7 @@
.Sh DESCRIPTION
.\" Crashed before mdoc_macro.c OpenBSD rev. 1.172
initial text
-.Bl -column 6n 6n
+.Bl -column 123456 123456
.It it Aq aq Ta ta Bo bo bc
.Bc Pq pq
.El