bug-gnu-emacs
[Top][All Lists]
Advanced

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

emacs-21.4 --with-x-toolkit=no on ia64 segfaults in XMakeAssoc


From: Ulrich Mueller
Subject: emacs-21.4 --with-x-toolkit=no on ia64 segfaults in XMakeAssoc
Date: Tue, 29 May 2007 11:19:08 +0200

[Problem reported by Raúl Porcel (armin76 at gentoo.org)]

Emacs 21.4 configured with --with-x-toolkit=no on ia64 terminates with
a segmentation fault in XMakeAssoc whenever one tries to access an X
menu:

Program received signal SIGSEGV, Segmentation fault.
0x4000000000339e50 in XMakeAssoc (dpy=0x60000000004f3c90, 
    table=<value optimized out>, x_id=20971750, data=0x60000000006d6ef0 "0Pm")
    at XMakeAssoc.c:95
95  XMakeAssoc.c: No such file or directory.
    in XMakeAssoc.c
#0  0x4000000000339e50 in XMakeAssoc (dpy=0x60000000004f3c90, 
    table=<value optimized out>, x_id=20971750, data=0x60000000006d6ef0 "0Pm")
    at XMakeAssoc.c:95
#1  0x40000000003381a0 in _XMWinQueFlush (display=0x60000000004f3c90, 
    menu=0x60000000006d4ef0, pane=0x60000000006d6ef0, select=7171824)
    at Internal.c:261

As far as I can see, the problem is that xmalloc is not declared in
the context of oldXMenu (src/lisp.h is not included) and its return
value will therefore be truncated to 32 bits.

OTOH, it seems to be safe to call plain malloc here since the menu
gets called only via xmenu_show and XMenuActivate. The former is
surrounded by BLOCK_INPUT / UNBLOCK_INPUT anyway (in src/xmenu.c).
Also, the routines in oldXMenu use malloc everywhere else.

The following patch fixes the problem here:

--- emacs-21.4/oldXMenu/XMakeAssoc.c~   1999-10-03 21:35:22.000000000 +0200
+++ emacs-21.4/oldXMenu/XMakeAssoc.c    2007-05-28 22:21:57.000000000 +0200
@@ -91,7 +91,7 @@
   /* If we are here then the new entry should be inserted just */
   /* before the current value of "Entry". */
   /* Create a new XAssoc and load it with new provided data. */
-  new_entry = (XAssoc *) xmalloc(sizeof(XAssoc));
+  new_entry = (XAssoc *) malloc(sizeof(XAssoc));
   new_entry->display = dpy;
   new_entry->x_id = x_id;
   new_entry->data = data;

Since that code is unchanged in the Emacs 22 CVS version, I would
expect that the problem exists there, too.

Ulrich




reply via email to

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