Subject: pkg/37610: Xaw3d segfaults when changing the text of a backed internationaled text widget
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <cesium2@gmail.com>
List: pkgsrc-bugs
Date: 12/25/2007 12:05:01
>Number:         37610
>Category:       pkg
>Synopsis:       Xaw3d segfaults when changing the text of a backed internationaled text widget
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Dec 25 12:05:01 +0000 2007
>Originator:     Yair K.
>Release:        N/A
>Organization:
>Environment:
Linux 2.6.23.9 x86_64
>Description:
Xaw3d may crash an application if an internationalized text  
widget's value is updated by the program, and useStringinPlace is False  
(default value) - xaw3d tries to free the incorrect address. I suspect Xaw-Xpm has this issue as well (the patch applies as well), though I haven't tested it.
>How-To-Repeat:
1) Compile timidity using XAW_TYPE=3d. Try to use tab-completion in the "Load file" window. timidity will segfault at once.
2) Compile gv using XAW_TYPE=3d. Crashes when selecting file names in the file->open dialog.

(This issue probably is OS independent, and should affect NetBSD systems as well).
>Fix:
1) Fix: the following patch is copied from Fedora[1], and will apply to version 1.5E as well:

--- Xaw3d-1.5/xc/lib/Xaw3d/MultiSrc.c.orig	Tue Aug  6 22:51:08 2002
+++ Xaw3d-1.5/xc/lib/Xaw3d/MultiSrc.c	Tue Aug  6 22:51:16 2002
@@ -735,6 +735,7 @@
   
   if ( string_set || (old_src->multi_src.type != src->multi_src.type) ) {
     RemoveOldStringOrFile(old_src, string_set);
+    src->multi_src.allocated_string = old_src->multi_src.allocated_string;
     file = InitStringOrFile(src, string_set);
 
     /* Load pieces does this logic for us, but it shouldn't.  Its messy.*/

2) Workaround: in the affected applications, XawAsciiSourceFreeString in the right places should prevent crashes (string_set becomes False).

[1] http://rpmfind.net//linux/RPM/fedora/7/x86_64/Xaw3d-1.5E-10.1.i386.html - see Aug 09 2002 entry.