groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[groff] 09/30: [troff]: Fix `phw` SEGV when no hyphenation lang.


From: G. Branden Robinson
Subject: [groff] 09/30: [troff]: Fix `phw` SEGV when no hyphenation lang.
Date: Fri, 8 Nov 2024 01:14:28 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit e05fb6b37773cf260e962ece11a98a4da495962f
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Thu Nov 7 10:17:06 2024 -0600

    [troff]: Fix `phw` SEGV when no hyphenation lang.
    
    * src/roff/troff/env.cpp (print_hyphenation_exceptions): Ensure that a
      current hyphenation language is defined before attempting to iterate
      its exception dictionary.
    
    Fixes:
      $ ./build/test-groff
      .hla
      .phw
      groff: error: troff: Segmentation fault (core dumped)
    
    Problem introduced by me in commit 0b40885e71, 3 November 2023.
---
 ChangeLog              | 14 ++++++++++++++
 src/roff/troff/env.cpp |  2 ++
 2 files changed, 16 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index e3155451b..c21b90045 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2024-11-07  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * src/roff/troff/env.cpp (print_hyphenation_exceptions): Ensure
+       that a current hyphenation language is defined before attempting
+       to iterate its exception dictionary.
+
+       Fixes:
+         $ ./build/test-groff
+         .hla
+         .phw
+         groff: error: troff: Segmentation fault (core dumped)
+
+       Problem introduced by me in commit 0b40885e71, 3 November 2023.
+
 2024-11-04  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        [grog]: Recognize new `phcode` request.
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index cff3abea0..ecb746d34 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -3817,6 +3817,8 @@ static void add_hyphenation_exceptions()
 
 static void print_hyphenation_exceptions()
 {
+  if (0 /* nullptr */ == current_language)
+    return;
   dictionary_iterator iter(current_language->exceptions);
   symbol entry;
   unsigned char *hypoint;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]