groff-commit
[Top][All Lists]
Advanced

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

[groff] 02/02: libdriver: Fix SEGV (Savannah #56555).


From: G. Branden Robinson
Subject: [groff] 02/02: libdriver: Fix SEGV (Savannah #56555).
Date: Wed, 26 Jun 2019 15:08:56 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit 5d0990500c2d16ed1025f1f0738cb419800652fe
Author: G. Branden Robinson <address@hidden>
Date:   Thu Jun 27 04:42:51 2019 +1000

    libdriver: Fix SEGV (Savannah #56555).
    
    Check result of set_char_and_width() for error condition before relying
    on it.
---
 ChangeLog                      | 7 +++++++
 src/libs/libdriver/printer.cpp | 8 +++++---
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 61e20b0..8e7973b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2019-06-27  G. Branden Robinson <address@hidden>
 
+       libdriver: Fix SEGV (Savannah #56555).
+
+       * src/libs/libdriver/printer.cpp: Check result of
+       set_char_and_width() for error condition before relying on it.
+
+2019-06-27  G. Branden Robinson <address@hidden>
+
        groff: Add regression test for Savannah #56555.
 
        * src/roff/groff/tests/regression-56555.sh: Provoke segfault
diff --git a/src/libs/libdriver/printer.cpp b/src/libs/libdriver/printer.cpp
index f20e4b0..773d438 100644
--- a/src/libs/libdriver/printer.cpp
+++ b/src/libs/libdriver/printer.cpp
@@ -178,9 +178,11 @@ void printer::set_ascii_char(unsigned char c, const 
environment *env,
   buf[1] = '\0';
 
   glyph *g = set_char_and_width(buf, env, &w, &f);
-  set_char(g, f, env, w, 0);
-  if (widthp) {
-    *widthp = w;
+
+  if (g != UNDEFINED_GLYPH ) {
+    set_char(g, f, env, w, 0);
+    if (widthp)
+      *widthp = w;
   }
 }
 



reply via email to

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