Follow-up Comment #2, bug #68837 (group groff):

`diff -b` reveals that the code change is less dramatic than it looks.


diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index c34275a17..a75396918 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -7056,9 +7056,15 @@ static bool read_font_identifier(font_lookup_info
*finfo)
   // interpretable as an (unsigned) decimal integer.  If is, we treat it
   // as a mounting position.  If not, we treat it as a font "name".
   symbol s = read_identifier();
+  if (s.is_null()) {
+    // The identifier was garbage, like `a\&b`.
+    skip_line();
+    return false;
+  }
+  assert(!s.is_empty());
+  if (s.is_empty()) // NDEBUG
+    return false;
   bool is_number = true;
-  assert(!s.is_null() && !s.is_empty());
-  if (!s.is_null() && !s.is_empty()) {
   const char *p = s.contents();
   assert(*p != 0 /* nullptr */);
   // Silently ignore a leading minus sign so we can issue a range
@@ -7071,7 +7077,6 @@ static bool read_font_identifier(font_lookup_info
*finfo)
       break;
     }
   }
-  }
   if (is_number) {
     errno = 0;
     long val = strtol(s.contents(), NULL, 10);
@@ -7089,7 +7094,6 @@ static bool read_font_identifier(font_lookup_info
*finfo)
   }
   else {
     finfo->requested_name = const_cast<char *>(s.contents());
-    if (!s.is_null()) {
     int mp = mounting_position_of_font(s);
     if (mp < 0) {
       mp = next_available_font_mounting_position();
@@ -7098,7 +7102,6 @@ static bool read_font_identifier(font_lookup_info
*finfo)
     }
     finfo->position = curenv->get_family()->resolve(mp);
   }
-  }
   return (finfo->position != FONT_NOT_MOUNTED);
 }




    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?68837>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

Attachment: signature.asc
Description: PGP signature

Reply via email to