From: Ingo Schwarze <schwarze@usta.de>
To: "Anthony J. Bentley" <anthony@cathet.us>
Cc: discuss@mdocml.bsd.lv
Subject: Re: Crash when run against groff tbl(1) output
Date: Tue, 14 Oct 2014 20:24:10 +0200 [thread overview]
Message-ID: <20141014182410.GJ28294@iris.usta.de> (raw)
In-Reply-To: <15458.1413266839@cathet.us>
Hi Anthony,
Anthony J. Bentley wrote on Tue, Oct 14, 2014 at 12:07:19AM -0600:
> Here is a reduced (possibly nonsensical) form of that input that
> triggers what I hope is the same crash; backtrace follows.
>
> .TS
> .if !'\n(.z'' \!.foo
> .de bar
> ..
> \!.baz
> .baz x
Here is a minimal example:
.TS
|.
\&
That makes it quite obvious what the problem is, doesn't it? ;-)
Committed fix below.
Thanks for reporting,
Ingo
Log Message:
-----------
even if a table has zero columns, do not segfault in the formatter;
bug reported by bentley@
Modified Files:
--------------
mdocml:
out.c
tbl_term.c
Revision Data
-------------
Index: out.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/out.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -Lout.c -Lout.c -u -p -r1.52 -r1.53
--- out.c
+++ out.c
@@ -158,7 +158,7 @@ tblcalc(struct rofftbl *tbl, const struc
tbl->cols = mandoc_calloc((size_t)sp->opts->cols,
sizeof(struct roffcol));
- for (maxcol = 0; sp; sp = sp->next) {
+ for (maxcol = -1; sp; sp = sp->next) {
if (TBL_SPAN_DATA != sp->pos)
continue;
spans = 1;
Index: tbl_term.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/tbl_term.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -Ltbl_term.c -Ltbl_term.c -u -p -r1.30 -r1.31
--- tbl_term.c
+++ tbl_term.c
@@ -107,7 +107,7 @@ term_tbl(struct termp *tp, const struct
/* Vertical frame at the start of each row. */
if ((TBL_OPT_BOX | TBL_OPT_DBOX) & sp->opts->opts ||
- sp->head->vert)
+ (sp->head != NULL && sp->head->vert))
term_word(tp, TBL_SPAN_HORIZ == sp->pos ||
TBL_SPAN_DHORIZ == sp->pos ? "+" : "|");
--
To unsubscribe send an email to discuss+unsubscribe@mdocml.bsd.lv
prev parent reply other threads:[~2014-10-14 18:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-14 6:07 Anthony J. Bentley
2014-10-14 18:24 ` Ingo Schwarze [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20141014182410.GJ28294@iris.usta.de \
--to=schwarze@usta.de \
--cc=anthony@cathet.us \
--cc=discuss@mdocml.bsd.lv \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).