Subject: Re: 23.0.95; Segmentation fault: ffap/image/C-x d

From: Chong Yidong <[email-masked]>
Date: Tue, 07 Jul 2009 18:29:09 -0400

> I can reproduce this.  From bisecting prior revisions, I think the
> problem first appeared with this change:
>
> 2009-03-24  Jason Rumney  <[email-masked]>
>
> 	* fileio.c (Fsubstitute_in_file_name): Always work on a copy.
> 	Calculate total size precisely.  Decode environment variables
> 	before substituting.  (Bug#38)

OK, I found the problem.  The way the string data was copied was
incorrect:

  nm = SDATA (filename);
  nm = strcpy (alloca (strlen (nm) + 1), nm);

This should have been

  nm = (unsigned char *) alloca (SBYTES (filename) + 1);
  bcopy (SDATA (filename), nm, SBYTES (filename) + 1);

I've checked a fix into CVS.