[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 02/17: [tbl]: Fix Savannah #63838.
From: |
G. Branden Robinson |
Subject: |
[groff] 02/17: [tbl]: Fix Savannah #63838. |
Date: |
Thu, 9 Mar 2023 15:03:04 -0500 (EST) |
gbranden pushed a commit to branch post-1.23.0
in repository groff.
commit e49cb8e18ff9f9975d4e0f3b236c7d2313a315fa
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.
---
src/preproc/tbl/table.cpp | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/preproc/tbl/table.cpp b/src/preproc/tbl/table.cpp
index 72bff0b9d..0dae4a4eb 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] 02/17: [tbl]: Fix Savannah #63838.,
G. Branden Robinson <=