From: schwarze@mandoc.bsd.lv
To: source@mandoc.bsd.lv
Subject: mandoc: When looking for column separators on tbl(7) data lines,
Date: Tue, 18 May 2021 08:23:13 -0500 (EST) [thread overview]
Message-ID: <c2a993617542fb41@mandoc.bsd.lv> (raw)
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
reply other threads:[~2021-05-18 13:23 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=c2a993617542fb41@mandoc.bsd.lv \
--to=schwarze@mandoc.bsd.lv \
--cc=source@mandoc.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).