unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* emacs-21.4 --with-x-toolkit=no on ia64 segfaults in XMakeAssoc
@ 2007-05-29  9:19 Ulrich Mueller
  0 siblings, 0 replies; only message in thread
From: Ulrich Mueller @ 2007-05-29  9:19 UTC (permalink / raw)
  To: bug-gnu-emacs

[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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-05-29  9:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-29  9:19 emacs-21.4 --with-x-toolkit=no on ia64 segfaults in XMakeAssoc Ulrich Mueller

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).