diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2013-06-01 04:56:42 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2013-06-01 04:56:42 +0000 |
commit | 347b54d81b72d3ce4f61e77eaf8cd064b735cac0 (patch) | |
tree | f722ef9190baff5f392fb801f0035d90832bd2df /usr.bin/mandoc | |
parent | 3ff69c8d64ca3992be2bac08ba4b9a647c6f6250 (diff) |
If a table contained at least one complete line
and on its last line, the first T{ remained unclosed,
roff_parseln() never returned ROFF_TBL for that last line,
so {man,mdoc}_addspan() never got called for that last line,
so we ended up with a table
where no line associated with a node had TBL_SPAN_LAST set,
so tbl_term() never free()'d the cols in struct roffcol,
so tblcalc() crashed on the NULL == tbl->cols assertion
when starting the *next* table in the same file.
Fix this by returning ROFF_TBL as soon as we open a data cell,
not only when finishing it - as explained above, it may never
get properly closed but instead be interrupted by .TE.
Problem reported by bentley@ in latex2man.1.
I love it when bugs take half a day to debug but
the fix turns out to be flipping one single bit in the source code.
Diffstat (limited to 'usr.bin/mandoc')
-rw-r--r-- | usr.bin/mandoc/tbl_data.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/mandoc/tbl_data.c b/usr.bin/mandoc/tbl_data.c index a70ac9e06d3..d4c59301a83 100644 --- a/usr.bin/mandoc/tbl_data.c +++ b/usr.bin/mandoc/tbl_data.c @@ -1,4 +1,4 @@ -/* $Id: tbl_data.c,v 1.13 2013/05/31 21:37:09 schwarze Exp $ */ +/* $Id: tbl_data.c,v 1.14 2013/06/01 04:56:41 schwarze Exp $ */ /* * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org> @@ -98,7 +98,7 @@ data(struct tbl_node *tbl, struct tbl_span *dp, if (*pos - sv == 2 && 'T' == p[sv] && '{' == p[sv + 1]) { tbl->part = TBL_PART_CDATA; - return(0); + return(1); } assert(*pos - sv >= 0); |