source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: even if a table has zero columns, do not segfault in the
@ 2014-10-14 18:18 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2014-10-14 18:18 UTC (permalink / raw)
  To: source

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 source+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-10-14 18:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-14 18:18 mdocml: even if a table has zero columns, do not segfault in the schwarze

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).