Package: wmaker
Version: 0.92.0-5
Followup-For: Bug #279862

I noticed the same segfaults after compiling and installing wmaker today. The 
reason
is dereferencing a NULL pointer that can happen in several places of the code 
when
there is a font setting line missing in the config file or when the config 
files are
missing.

The patch is attached.
 
-- System Information:
Debian Release: 3.1
Architecture: i386 (i686)
Kernel: Linux 2.4.30
Locale: LANG=ru_RU.KOI8-R, LC_CTYPE=ru_RU.KOI8-R (charmap=KOI8-R)

Versions of packages wmaker depends on:
ii  cpp                   4:3.3.5-3          The GNU C preprocessor (cpp)
ii  debianutils           2.8.4              Miscellaneous utilities specific t
ii  libc6                 2.3.2.ds1-22       GNU C Library: Shared libraries an
ii  libfontconfig1        2.3.1-2            generic font configuration library
ii  libfreetype6          2.1.7-2.4          FreeType 2 font engine, shared lib
ii  libwraster3           0.92.0-5           Shared libraries of Window Maker r
ii  libx11-6              6.8.2.dfsg.1-7bpo1 X Window System protocol client li
ii  libxext6              6.8.2.dfsg.1-7bpo1 X Window System miscellaneous exte
ii  libxft2               2.1.7-1            FreeType-based font drawing librar
ii  libxinerama1          6.8.2.dfsg.1-7bpo1 X Window System multi-head display
ii  libxrender1           1:0.9.0-1bpo1      X Rendering Extension client libra
ii  xlibs                 6.8.2.dfsg.1-7bpo1 X Window System client libraries m
ii  zlib1g                1:1.2.2-4.sarge.2  compression library - runtime

-- no debconf information
--- wmaker-0.92.0.orig/WPrefs.app/FontSimple.c	2004-10-26 15:03:42.000000000 +0300
+++ wmaker-0.92.0/WPrefs.app/FontSimple.c	2005-10-08 21:47:09.000000000 +0300
@@ -358,18 +358,19 @@
     WMMenuItem *item= WMGetPopUpButtonMenuItem(panel->optionP,
                                            WMGetPopUpButtonSelectedItem(panel->optionP));
     char *fn= WMGetMenuItemRepresentedObject(item);
-    WMFont *font= WMCreateFont(WMWidgetScreen(panel->box), fn);
-
-    if (font)
-    {
-        WMSetTextFieldFont(panel->sampleT, font);
-        WMReleaseFont(font);
+	if (fn)
+	{
+        WMFont *font= WMCreateFont(WMWidgetScreen(panel->box), fn);
+        if (font)
+        {
+            WMSetTextFieldFont(panel->sampleT, font);
+            WMReleaseFont(font);
+        }
     }
 }
 
 
 
-
 static void
 selectedFamily(WMWidget *w, void *data)
 {
@@ -449,10 +450,12 @@
             char *ofont, *nfont;
 
             ofont= (char*)WMGetMenuItemRepresentedObject(item);
-            
-            nfont= getSelectedFont(panel, ofont);
-            free(ofont);
-            WMSetMenuItemRepresentedObject(item, nfont);
+            if (ofont)
+            {
+                nfont= getSelectedFont(panel, ofont);
+                free(ofont);
+                WMSetMenuItemRepresentedObject(item, nfont);
+            }
         }
         updateSampleFont(panel);
     }
@@ -468,11 +471,12 @@
     char *ofont, *nfont;
 
     ofont= (char*)WMGetMenuItemRepresentedObject(item);
-    
-    nfont= getSelectedFont(panel, ofont);
-    free(ofont);
-    WMSetMenuItemRepresentedObject(item, nfont);
-
+    if (ofont)
+	{
+        nfont= getSelectedFont(panel, ofont);
+        free(ofont);
+        WMSetMenuItemRepresentedObject(item, nfont);
+	}
     updateSampleFont(panel);
 }
 

Reply via email to