Subject: bug#23667: 24.4; "Stack overflow in regexp matcher" happens in only some buffers, for the same arguments

From: Ernesto Alfonso <[email-masked]>
Date: Tue, 31 May 2016 19:41:20 -0700

(let ((out (shell-command-to-string "curl http://pastebin.com/raw/a2pMaW6h")))
	 (string-match "\\(^[[:space:]]*\\([a-z]+\\) = \\(.*\\)\n\\)+" out 0))

If I try this sexp on an ielm-mode or emacs-lisp-mode buffer (just two
examples I tested), this evaluates to 0. If I try it on a message-mode
or erc buffer, I get "Stack overflow in regexp matcher".

The evaluation should be independent of the buffer since no buffer
contents should be involved.

In GNU Emacs 24.4.1 (x86_64-pc-linux-gnu, GTK+ Version 3.14.5)
 of 2015-03-07 on trouble, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.11604000
System Description:	Debian GNU/Linux 8.4 (jessie)

Configured using:
 `configure --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/lib
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-pop=yes
 --enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.4/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.4/site-lisp:/usr/share/emacs/site-lisp
 --build x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib
 --libexecdir=/usr/lib --localstatedir=/var/lib
 --infodir=/usr/share/info --mandir=/usr/share/man --with-pop=yes
 --enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.4/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.4/site-lisp:/usr/share/emacs/site-lisp
 --with-x=yes --with-x-toolkit=gtk3 --with-toolkit-scroll-bars
 'CFLAGS=-g -O2 -fstack-protector-strong -Wformat
 -Werror=format-security -Wall' CPPFLAGS=-D_FORTIFY_SOURCE=2
 LDFLAGS=-Wl,-z,relro'

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

Major mode: ERC

Minor modes in effect:
  shell-dirtrack-mode: t
  erc-list-mode: t
  erc-menu-mode: t
  erc-autojoin-mode: t
  erc-ring-mode: t
  erc-networks-mode: t
  erc-pcomplete-mode: t
  erc-track-mode: t
  erc-track-minor-mode: t
  erc-match-mode: t
  erc-button-mode: t
  erc-fill-mode: t
  erc-stamp-mode: t
  erc-netsplit-mode: t
  erc-irccontrols-mode: t
  erc-noncommands-mode: t
  erc-move-to-prompt-mode: t
  erc-readonly-mode: t
  text-scale-mode: t
  sexchange-mode: 0
  show-paren-mode: t
  global-text-scale-mode: t
  global-erjoalgo-command-mode: t
  erjoalgo-command-mode: t
  tooltip-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

Recent input:
p p n n n <f1> M-r l e n <return> <return> <f1> <s-f4> 
p r e w c c c c c c c c c c c x o <f1> m <f1> <f1> 
. v C-x C-e m e 3 e x <tab> a n <tab> <return> - z 
3 e x <tab> g e n <tab> <return> 2 2 2 2 2 1 x n v 
a D x ; <f5> i n s e r t SPC e x <escape> <return> 
, r . x x a l n u <tab> <return> M-1 r , C-g 2 2 2 
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 . s <M-backspace> 
<backspace> ~ <backspace> / t m p <tab> o u t <return> 
x ; C-g <f1> <f1> ' , ' a r M-f C-g / / 1 1 , <f3> 
e r j o a <f3> <escape> , r . x x <up> <return> 1 r 
, x x <up> <return> , . x ; s-e e x SPC <backspace> 
- 2 SPC <f5> b u f f e <tab> <tab> - c o n <tab> <M-backspace> 
s u <tab> <tab> SPC <f5> p o i n t - m i n <escape> 
<f1> W SPC v <M-f3> i <escape> M-d <f1> a x <f1> e 
<escape> <escape> <return> x i . <f1> M-p <f1> <help-echo> 
b <help-echo> <f1> - 2 <return> M-p M-p M-p <return> 
<f1> p p k x o <f1> m <f1> <f1> . v C-x C-e 4 # e r 
<tab> <backspace> <backspace> <tab> e m <tab> <return> 
. v C-x C-e x x e r <M-backspace> r e p o r t - e m 
<tab> <return>

Recent messages:

   lasa = [:dfrsphr \"[email-masked]\"]
xnoevvl = [:tzmv \"Isymqh Dhfpvdpx\"]
"
Mark set [4 times]
eval: Stack overflow in regexp matcher
Making completion list...
Mark set [2 times]
eval: Stack overflow in regexp matcher
Quit

Load-path shadows:
/home/ealfonso/.emacs.d/elpa/go-mode-20160220.1751/go-mode-autoloads hides /home/ealfonso/repos/dotemacs/libs/go-mode-autoloads
/home/ealfonso/.emacs.d/elpa/go-mode-20160220.1751/go-mode hides /home/ealfonso/repos/dotemacs/libs/go-mode
/usr/share/emacs/24.4/site-lisp/debian-startup hides /usr/share/emacs/site-lisp/debian-startup
/usr/share/emacs24/site-lisp/dictionaries-common/ispell hides /usr/share/emacs/24.4/lisp/textmodes/ispell
/usr/share/emacs/site-lisp/rst hides /usr/share/emacs/24.4/lisp/textmodes/rst
/usr/share/emacs24/site-lisp/dictionaries-common/flyspell hides /usr/share/emacs/24.4/lisp/textmodes/flyspell

Features:
(shadow emacsbug sendmail cc-langs cc-mode cc-fonts cc-guess cc-menus
cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs nnir tramp-cache
filecache sgml-mode debug slime-fancy slime-trace-dialog
slime-fontifying-fu slime-package-fu slime-references
slime-compiler-notes-tree slime-scratch slime-presentations bridge
slime-macrostep macrostep slime-mdot-fu slime-enclosing-context
slime-fuzzy slime-fancy-trace slime-fancy-inspector slime-c-p-c
slime-editing-commands slime-autodoc slime-repl elp slime-parse slime
gud apropos hyperspec sh-script smie executable python url-handlers sort
gnus-cite smiley shr browse-url mm-archive gnus-async gnus-bcklg qp
gnus-ml disp-table nndraft nnmh nnfolder utf-7 gnutls nnimap parse-time
utf7 netrc gnus-agent gnus-srvr gnus-score score-mode nnvirtual gnus-msg
gnus-art mm-uu mml2015 mm-view mml-smime smime dig nntp gnus-cache
gnus-sum nnoo gnus-group gnus-undo nnmail mail-source gnus-start
gnus-spec gnus-int gnus-range message rfc822 mml mml-sec mm-decode
mm-bodies mm-encode mailabbrev gmm-utils mailheader gnus-win gnus
gnus-ems nnheader mail-utils dired-aux mail-extr pkg-info url-http
url-auth mail-parse rfc2231 rfc2047 rfc2045 ietf-drums url-gw json
lisp-mnt epl cider tramp-sh cider-debug cider-browse-ns cider-inspector
cider-mode cider-interaction arc-mode archive-mode cider-repl
cider-resolve cider-test cider-overlays cider-stacktrace cider-doc
org-table cider-grimoire cider-popup cider-eldoc eldoc cider-client
cider-common cider-util nrepl-client tramp tramp-compat tramp-loaddefs
trampver shell queue nrepl-dict cider-compat seq seq-24 ewoc spinner
mule-util clojure-mode align imenu network-stream starttls tls erc-list
erc-menu erc-join erc-ring erc-networks erc-pcomplete erc-track
erc-match erc-button wid-edit erc-fill erc-stamp erc-netsplit
erc-goodies erc erc-backend erc-compat eieio-opt speedbar sb-image
ezimage dframe edebug ielm pp go-mode url url-proxy url-privacy
url-expand url-methods url-history url-cookie url-domsuf url-util
mailcap find-file etags misearch multi-isearch face-remap help-mode ffap
thingatpt url-parse auth-source eieio byte-opt bytecomp byte-compile
cconv eieio-core mm-util mail-prsvr password-cache url-vars diary-lib
diary-loaddefs cal-iso vc-git org-element org-rmail org-mhe org-irc
org-info org-gnus gnus-util org-docview doc-view jka-compr image-mode
dired org-bibtex bibtex org-bbdb org-w3m org-agenda tmp-completions
tetris-o-1 sexchange-mode debian-forum-post-mode wm-windows
slime-autoloads epa derived epg org-crypt org org-macro org-footnote
org-pcomplete pcomplete org-list org-faces org-entities noutline outline
org-version ob-emacs-lisp ob ob-tangle ob-ref ob-lob ob-table ob-exp
org-src ob-keys ob-comint ob-core ob-eval org-compat org-macs
org-loaddefs format-spec find-func cal-menu calendar cal-loaddefs
compile comint ansi-color ring plusx proxy-mode my-emacs-settings paren
server easymenu go-mode-autoloads package epg-config legalese
isearch-fast-reverse zoom-global erjoalgo-command-mode
command-mode-commands wombat-theme edmacro kmacro cl-macs easy-mmode cl
cl-loaddefs cl-lib quick-yes advice help-fns goto-last-change f dash gv
s ucs-normalize time-date tooltip electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt
fringe tabulated-list newcomment lisp-mode prog-mode register page
menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core frame cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer nadvice
loaddefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process dbusbind
gfilenotify dynamic-setting system-font-setting font-render-setting
move-toolbar gtk x-toolkit x multi-tty emacs)

Memory information:
((conses 16 1333406 146899)
 (symbols 48 59260 0)
 (miscs 40 2251 6192)
 (strings 32 162441 28922)
 (string-bytes 1 6693016)
 (vectors 16 83154)
 (vector-slots 8 1992903 167205)
 (floats 8 581 1083)
 (intervals 56 149633 1235)
 (buffers 960 129)
 (heap 1024 114485 7136))