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

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

Re: crash on powerpc-ibm-aix5.1.0.0


From: Dan Nicolaescu
Subject: Re: crash on powerpc-ibm-aix5.1.0.0
Date: Sun, 18 Sep 2005 09:52:46 -0700

The cause of the crash is a memory corruption happening in
buffer.c:init_buffer:


[snip]
  pwd = get_current_dir_name ();

  if (!pwd)
    fatal ("`get_current_dir_name' failed: %s\n", strerror (errno));

#ifndef VMS
  /* Maybe this should really use some standard subroutine
     whose definition is filename syntax dependent.  */
  rc = strlen (pwd);
  if (!(IS_DIRECTORY_SEP (pwd[rc - 1])))
    {
      /* Grow buffer to add directory separator and '\0'.  */
      pwd = (char *) xrealloc (pwd, rc + 2);
      pwd[rc] = DIRECTORY_SEP;
      pwd[rc + 1] = '\0';
    }
#endif /* not VMS */

on this powerpc-ibm-aix5.1.0.0 system HAVE_GET_CURRENT_DIR_NAME 
is defined to 1 so the libc version of get_current_dir_name is used. 
get_current_dir_name returns malloced memory. 
On this system the memory allocator in gmalloc.c is used. 
So what happens is the xrealloc call corrupts memory because
get_current_dir_name is using a different memory allocator... 
If I change the #ifndef HAVE_GET_CURRENT_DIR_NAME in sysdep.c to 
#if 1 then everything works OK.

What is the best way to fix this?

        --dan





reply via email to

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