#27 crash in _XmMenuArmItem with DEBUG_SOURCES=all


With LessTif 0.95.0 compiled from source with the default configuration options on Mac OS X 10.2 (Apple's gcc 3.1 is the compiler; X libraries and headers from XDarwin's package of XFree86 4.2), running a LessTif application with the environment variable DEBUG_SOURCES set to all causes the application to crash with a bus error when clicking on a menu bar to display a pulldown menu. For instance, running the test/Xm/cascadebutton/test1 program under gdb with DEBUG_SOURCES set to all gave the following stack trace at the point of the bus error after clicking on the first item in the menu bar:

#0 0x90000e90 in strlen ()
#1 0x90001c40 in vfprintf ()
#2 0x900156e0 in __sbprintf ()
#3 0x90001108 in vfprintf ()
#4 0x00621e0c in _LtDebug (fn=0x71e7a4 "�", w=0x149720, fmt=0x6fe244 "_XmMenuArmItem() - %s\n") at DebugUtil.c:718
#5 0x00667bdc in _XmMenuArmItem (w=0x149720) at MenuUtil.c:626
#6 0x0067e200 in MenuProcEntry (proc=2, w=0x1469f0) at RowColumn.c:1864
#7 0x00617b20 in _XmCBMenuBarDoSelect (w=0x149030, event=0xbffff830, params=0xbffff384, num_params=0x3a20) at CascadeB.c:839
#8 0x00107458 in HandleActions ()
#9 0x00107940 in HandleSimpleState ()
#10 0x00107e70 in _XtTranslateEvent ()
#11 0x000e6ea8 in XtDispatchEventToWidget ()
#12 0x000e7764 in _XtDefaultDispatcher ()
#13 0x000e7970 in XtDispatchEvent ()
#14 0x000e7c8c in XtAppMainLoop ()
#15 0x00004604 in LessTifTestMainLoop (w=0x139180) at Test.c:538
#16 0x000030d8 in main (argc=1, argv=0xbffffaa0) at test1.c:157
#17 0x00002834 in _start (argc=1, argv=0xbffffaa0, envp=0xbffffaa8) at /SourceCache/Csu/Csu-45/crt.c:267
#18 0x000026b4 in start ()

The attached patch fixes the problem by restoring the argument for the %s format that was present in version 1.56 of lib/Xm/MenuUtil.c. The patch was computed against the LessTif CVS files as of 31 March 2008 and can be applied by running

patch -Np1 <name_of_patch_file

in the top-level directory for the LessTif files.


  • Paul Gevers

    Paul Gevers - 2009-04-29

    Thanks. Bug contained a patch. Will look at it later.


Log in to post a comment.