Subject: bug#46108: 28.0.50; etags segfault

From: mats cronqvist <[email-masked]>
Date: Mon, 25 Jan 2021 22:35:42 +0100

$ etags ~/f.erl
Segmentation fault

where f.erl looks like this;
$ cat f.erl
-module(f).
-export([x/0]).
x() ->
    y().
-spec y() -> y.
y() ->
    y.

Possibly relevant; with the diff below I can successfully process a few
thousand files (including the Erlang standard library).

$ git diff
diff --git a/lib-src/etags.c b/lib-src/etags.c
index 4315771..78db8dc 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -6059,11 +6059,6 @@ Erlang_functions (FILE *inf)
       else if (cp[0] == '-')   /* attribute, e.g. "-define" */
        {
          erlang_attribute (cp);
-         if (last != NULL)
-           {
-             free (last);
-             last = NULL;
-           }
        }
       else
        {

In GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.24,
cairo version 1.16.0)
 of 2020-12-18 built on royksopp
Repository revision: 3df4ca451d41a5f1036713277ef55ca9734c6fa7
Repository branch: pgtk
Windowing system distributor 'System Description: Debian GNU/Linux
bullseye/sid

Configured using:
 'configure --with-pgtk --with-cairo --with-modules --without-makeinfo'

Configured features:
PNG CAIRO SOUND DBUS GSETTINGS GLIB NOTIFY INOTIFY LIBSELINUX GNUTLS
FREETYPE
HARFBUZZ ZLIB TOOLKIT_SCROLL_BARS GTK3 PGTK XIM MODULES THREADS PDUMPER

Important settings:
  value of $LANG: en_US.utf8
  locale-coding-system: utf-8-unix

Major mode: ELisp/l

Minor modes in effect:
  global-highlight-parentheses-mode: t
  highlight-parentheses-mode: t
  global-whitespace-mode: t
  magit-auto-revert-mode: t
  global-git-commit-mode: t
  async-bytecomp-package-mode: t
  shell-dirtrack-mode: t
  global-flycheck-mode: t
  flycheck-mode: t
  nyan-mode: t
  display-time-mode: t
  delete-selection-mode: t
  show-paren-mode: t
  pallet-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug sendmail cl-indent cus-edit cus-start
cus-load
wid-edit mm-archive mule-util gnutls network-stream url-http url-gw nsm
url-cache url-auth pulse cl-print eieio-opt speedbar ezimage dframe shortdoc
erlang-test ert pp ewoc debug backtrace help-fns radix-tree markdown-mode
color
noutline outline bazel-mode bazel-util python tramp-sh tramp tramp-loaddefs
trampver tramp-integration files-x tramp-compat parse-time iso8601 ls-lisp
flymake-proc flymake ffap thingatpt xml sh-script smie executable flyspell
ispell grep compile misearch multi-isearch erldoc vc-git erlang etags
fileloop
generator xref project tempo pcase smart-mode-line rich-minority
gruvbox-dark-hard-theme gruvbox autothemer highlight-parentheses whitespace
magit-submodule magit-obsolete magit-popup magit-blame magit-stash
magit-reflog
magit-bisect magit-push magit-pull magit-fetch magit-clone magit-remote
magit-commit magit-sequence magit-notes magit-worktree magit-tag magit-merge
magit-branch magit-reset magit-files magit-refs magit-status magit
magit-repos
magit-apply magit-wip magit-log which-func imenu magit-diff smerge-mode diff
diff-mode magit-core magit-autorevert autorevert filenotify magit-margin
magit-transient magit-process magit-mode git-commit transient format-spec
magit-git magit-section magit-utils crm log-edit easy-mmode message rmc puny
dired dired-loaddefs rfc822 mml mml-sec epa derived epg epg-config gnus-util
rmail rmail-loaddefs text-property-search time-date mm-decode mm-bodies
mm-encode mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr
mailabbrev mail-utils gmm-utils mailheader pcvs-util add-log with-editor
cl-extra async-bytecomp async shell pcomplete comint ring fdlcap masserlang
erlang-start align flycheck ansi-color find-func help-mode nyan-mode server
time ido delsel paren pallet advice rx edmacro kmacro warnings cask
cask-bootstrap ansi package-recipe-mode package-build-badges package-build
package-recipe eieio-compat lisp-mnt shut-up epl git commander f dash s
finder-inf info package easymenu browse-url url url-proxy url-privacy
url-expand url-methods url-history url-cookie url-domsuf url-util mailcap
url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs
eieio-loaddefs password-cache json subr-x map url-vars seq byte-opt gv
bytecomp
byte-compile cconv cl-loaddefs cl-lib tooltip eldoc electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel term/pgtk-win pgtk-win
term/common-win tool-bar dnd fontset image regexp-opt fringe tabulated-list
replace newcomment text-mode elisp-mode lisp-mode prog-mode register page
tab-bar menu-bar rfn-eshadow isearch timer select scroll-bar mouse jit-lock
font-lock syntax facemenu font-core term/tty-colors frame minibuffer
cl-generic
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic
indian cyrillic chinese composite charscript charprop case-table epa-hook
jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice button
loaddefs
faces cus-face macroexp files window text-properties overlay sha1 md5 base64
format env code-pages mule custom widget hashtable-print-readable backquote
threads dbusbind inotify dynamic-setting system-font-setting
font-render-setting cairo move-toolbar gtk x-toolkit pgtk multi-tty
make-network-process emacs)

Memory information:
((conses 16 1670916 286430)
 (symbols 48 31819 436)
 (strings 32 247118 34176)
 (string-bytes 1 8231634)
 (vectors 16 75961)
 (vector-slots 8 1518453 81991)
 (floats 8 378 1831)
 (intervals 56 203310 13173)
 (buffers 984 63))