[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 32/33: [tbl]: Fix Savannah #63838.
From: |
G. Branden Robinson |
Subject: |
[groff] 32/33: [tbl]: Fix Savannah #63838. |
Date: |
Wed, 22 Mar 2023 22:11:47 -0400 (EDT) |
gbranden pushed a commit to branch branden-post-1.23.0
in repository groff.
commit d036588d6528d712d390e1e6769303aedb6e67a7
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 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] 32/33: [tbl]: Fix Savannah #63838.,
G. Branden Robinson <=