source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mandoc: When looking for column separators on tbl(7) data lines,
@ 2021-05-18 13:23 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2021-05-18 13:23 UTC (permalink / raw)
  To: source

Log Message:
-----------
When looking for column separators on tbl(7) data lines, properly skip
escape sequences; do not misinterpret bytes from the middle of escape
sequence names or arguments as column separators.
Bug reported and patch tested by Oliver dot Corff at email dot de.

Modified Files:
--------------
    mandoc:
        tbl_data.c

Revision Data
-------------
Index: tbl_data.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/tbl_data.c,v
retrieving revision 1.54
retrieving revision 1.55
diff -Ltbl_data.c -Ltbl_data.c -u -p -r1.54 -r1.55
--- tbl_data.c
+++ tbl_data.c
@@ -1,7 +1,7 @@
 /*	$Id$ */
 /*
  * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2011,2015,2017,2018,2019 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2011,2015,2017-2019,2021 Ingo Schwarze <schwarze@openbsd.org>
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -46,6 +46,7 @@ getdata(struct tbl_node *tbl, struct tbl
 	struct tbl_dat	*dat, *pdat;
 	struct tbl_cell	*cp;
 	struct tbl_span	*pdp;
+	const char	*ccp;
 	int		 sv;
 
 	/*
@@ -54,8 +55,11 @@ getdata(struct tbl_node *tbl, struct tbl
 	 */
 
 	sv = *pos;
-	while (p[*pos] != '\0' && p[*pos] != tbl->opts.tab)
-		(*pos)++;
+	ccp = p + sv;
+	while (*ccp != '\0' && *ccp != tbl->opts.tab)
+		if (*ccp++ == '\\')
+			mandoc_escape(&ccp, NULL, NULL);
+	*pos = ccp - p;
 
 	/* Advance to the next layout cell, skipping spanners. */
 
--
 To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv


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

only message in thread, other threads:[~2021-05-18 13:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-18 13:23 mandoc: When looking for column separators on tbl(7) data lines, 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).