source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: If a table contained at least one complete line  and on its last
@ 2013-06-01  4:56 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2013-06-01  4:56 UTC (permalink / raw)
  To: source

Log Message:
-----------
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.

Modified Files:
--------------
    mdocml:
        tbl_data.c

Revision Data
-------------
Index: tbl_data.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/tbl_data.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -Ltbl_data.c -Ltbl_data.c -u -p -r1.26 -r1.27
--- tbl_data.c
+++ tbl_data.c
@@ -102,7 +102,7 @@ data(struct tbl_node *tbl, struct tbl_sp
 
 	if (*pos - sv == 2 && 'T' == p[sv] && '{' == p[sv + 1]) {
 		tbl->part = TBL_PART_CDATA;
-		return(0);
+		return(1);
 	}
 
 	assert(*pos - sv >= 0);
--
 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:[~2013-06-01  4:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-01  4:56 mdocml: If a table contained at least one complete line and on its last 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).