gbranden pushed a commit to branch branden-2023-07-05 in repository groff. commit 89658b57fb8d49ebeb5cbf8b1212303386d30433 Author: G. Branden Robinson <g.branden.robin...@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 4036385f1..ab68f9ab1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2023-02-25 G. Branden Robinson <g.branden.robin...@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.robin...@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; _______________________________________________ Groff-commit mailing list Groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit