[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 64/105: [tbl]: Fix Savannah #63838.
From: |
G. Branden Robinson |
Subject: |
[groff] 64/105: [tbl]: Fix Savannah #63838. |
Date: |
Mon, 22 May 2023 03:39:06 -0400 (EDT) |
gbranden pushed a commit to branch branden-2023-05-22
in repository groff.
commit 51c873b9f61e9b369d18778b09c3d7be6dd44035
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sat Feb 25 18:44:58 2023 -0600
[tbl]: Fix Savannah #63838.
* src/preproc/tbl/table.cpp (table::add_entry): Throw error diagnostic
if table entry ends in the zero-motion escape sequence `\z`. This is
nonsense and provokes baffling diagnostics from the formatter. Stick
user's nose directly into the problem.
Fixes <https://savannah.gnu.org/bugs/?63838>. Thanks to the mandoc(1)
project for documenting the issue in a regression test.
Also annotate a null pointer with `nullptr` comment to ease any future
transition to C++11, which defines it as a keyword.
---
ChangeLog | 14 ++++++++++++++
src/preproc/tbl/table.cpp | 9 ++++++++-
2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index b108ebb88..cf8daf3f6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2023-02-25 G. Branden Robinson <g.branden.robinson@gmail.com>
+
+ [tbl]: Fix Savannah #63838.
+
+ * src/preproc/tbl/table.cpp (table::add_entry): Throw error
+ diagnostic if table entry ends in the zero-motion escape
+ sequence `\z`. This is nonsense and provokes baffling
+ diagnostics from the formatter. Stick user's nose directly into
+ the problem.
+
+ Fixes <https://savannah.gnu.org/bugs/?63838>. Thanks to the
+ mandoc(1) project for documenting the issue in a regression
+ test.
+
2023-04-16 G. Branden Robinson <g.branden.robinson@gmail.com>
[build]: Improve portability to non-GNU, non-LLVM compilers.
diff --git a/src/preproc/tbl/table.cpp b/src/preproc/tbl/table.cpp
index c391c90ae..a12874d2b 100644
--- a/src/preproc/tbl/table.cpp
+++ b/src/preproc/tbl/table.cpp
@@ -1513,7 +1513,14 @@ void table::add_entry(int r, int c, const string &str,
const entry_format *f, const char *fn, int ln)
{
allocate(r);
- table_entry *e = 0;
+ table_entry *e = 0 /* nullptr */;
+ int len = str.length();
+ if (len > 1) {
+ string last_two_chars = str.substring((len - 2), 2);
+ if ("\\z" == last_two_chars)
+ error_with_file_and_line(fn, ln, "table entry ends with"
+ " zero-motion escape sequence");
+ }
char *s = str.extract();
if (str.search('\n') >= 0) {
bool was_changed = false;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 64/105: [tbl]: Fix Savannah #63838.,
G. Branden Robinson <=