Subject: bug#12306: etags crashes

From: Eli Zaretskii <[email-masked]>
Date: Fri, 31 Aug 2012 18:54:17 +0300

> From: Glenn Morris <[email-masked]>
> Date: Wed, 29 Aug 2012 22:01:34 -0400
> Cc: [email-masked]
> 
> Viking Rollo wrote:
> 
> >>svn co svn://svn.gna.org/svn/gnustep/trunk gnustep
> >
> >>cd gnustep
> >>find . -iname "*.[mh]" -print | c:\EMACS\NTEmacs\bin\etags.exe -
> 
> Works fine for me on x86_64 GNU/Linux.

Crashes for me on x86_64 GNU/Linux:

  Program received signal SIGSEGV, Segmentation fault.
  0x00007ffff7ae06d1 in mempcpy () from /lib/libc.so.6
  (gdb) bt
  #0  0x00007ffff7ae06d1 in mempcpy () from /lib/libc.so.6
  #1  0x00007ffff7acd197 in _IO_file_xsputn () from /lib/libc.so.6
  #2  0x00007ffff7ac2b0c in fputs () from /lib/libc.so.6
  #3  0x0000000000403654 in put_entries (np=0x647410)
      at /home/e/eliz/bzr/emacs/trunk/lib-src/etags.c:2190
  #4  0x0000000000402b81 in process_file (fh=0x63cf20,
      fn=0x647640 "./modules/dev-libs/gscoredata/DataBuilder/Document.m",
      lang=0x0) at /home/e/eliz/bzr/emacs/trunk/lib-src/etags.c:1673
  #5  0x0000000000402918 in process_file_name (
      file=0x623280 "./modules/dev-libs/gscoredata/DataBuilder/Document.m",
      lang=0x0) at /home/e/eliz/bzr/emacs/trunk/lib-src/etags.c:1597
  #6  0x0000000000402180 in main (argc=2, argv=0x7fffffffe5b8)
      at /home/e/eliz/bzr/emacs/trunk/lib-src/etags.c:1273
  (gdb) frame 3
  #3  0x0000000000403654 in put_entries (np=0x647410)
      at /home/e/eliz/bzr/emacs/trunk/lib-src/etags.c:2190
  2190              fputs (np->regex, tagf);
  (gdb) l
  2185                  fdp = np->fdp;
  2186                  fprintf (tagf, "\f\n%s,%d\n",
  2187                           fdp->taggedfname, total_size_of_entries (np));
  2188                  fdp->written = TRUE;
  2189                }
  2190              fputs (np->regex, tagf);
  2191              fputc ('\177', tagf);
  2192              if (np->name != NULL)
  2193                {
  2194                  fputs (np->name, tagf);
  (gdb) p np->regex
  $1 = 0x647d30 "  * const ConfigurationsDidChangeNotification "
  (gdb) p *np
  $2 = {left = 0x0, right = 0x6473a0, fdp = 0x646d70, name = 0x0,
    regex = 0x647d30 "  * const ConfigurationsDidChangeNotification ",
    valid = 1, is_func = 0, been_warned = 0, lno = 39, cno = 1134}

Not sure why it crashes (stack smashed?).