Update of bug #68836 (group groff):
Status: Confirmed => In Progress
Planned Release: None => 1.25.0
Summary: [troff] assertion failure when `ftr` request given
invalid first identifier => [PATCH] [troff] assertion failure when `ftr`
request given invalid first identifier
_______________________________________________________
Follow-up Comment #1:
diff --git a/ChangeLog b/ChangeLog
index 37452fb2f..6a525d82e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2026-10-25 G. Branden Robinson <[email protected]>
+
+ * src/roff/troff/node.cpp (translate_font_request): Replace
+ assert(3)ion that could be tripped by invalid characters in
+ font identifier with skip of input line. Also revise logic to
+ use more early returns, simplifying conditional tests.
+
+ Fixes <https://savannah.gnu.org/bugs/?68836>. Problem
+ introduced by me in commit ddfc1b7045, 2023-08-27.
+
2026-10-25 G. Branden Robinson <[email protected]>
[groff]: Regression-test Savannah #68836.
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index 59c88833c..c34275a17 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -6825,20 +6825,28 @@ static void translate_font_request() // .ftr
return;
}
symbol from = read_identifier(true /* want_diagnostic */);
- // has_arg()+read_identifier() should ensure the assertion succeeds.
- assert(!from.is_null());
+ if (from.is_null()) {
+ // The identifier was garbage, like `a\&b`.
+ skip_line();
+ return;
+ }
if (is_nonnegative_integer(from.contents())) {
error("cannot translate a font mounting position");
skip_line();
return;
}
symbol to = read_identifier();
- if ((!to.is_null()) && is_nonnegative_integer(to.contents())) {
+ if (to.is_null()) {
+ // The identifier was garbage, like `a\&b`.
+ skip_line();
+ return;
+ }
+ if (is_nonnegative_integer(to.contents())) {
error("cannot translate to a font mounting position");
skip_line();
return;
}
- if (to.is_null() || from == to)
+ if (from == to)
font_translation_dictionary.remove(from);
else
(void) font_translation_dictionary.lookup(from,
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?68836>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
signature.asc
Description: PGP signature
