unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#23667: 24.4; "Stack overflow in regexp matcher" happens in only some buffers, for the same arguments
@ 2016-06-01  2:41 Ernesto Alfonso
  2016-06-01  6:36 ` Glenn Morris
  0 siblings, 1 reply; 5+ messages in thread
From: Ernesto Alfonso @ 2016-06-01  2:41 UTC (permalink / raw)
  To: 23667


(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 \"ckuaklihrdsf+t43w5fnm@buyhnkekuyml.ufy\"]
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))





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#23667: 24.4; "Stack overflow in regexp matcher" happens in only some buffers, for the same arguments
  2016-06-01  2:41 bug#23667: 24.4; "Stack overflow in regexp matcher" happens in only some buffers, for the same arguments Ernesto Alfonso
@ 2016-06-01  6:36 ` Glenn Morris
  2016-06-01 14:42   ` Ernesto Alfonso
  0 siblings, 1 reply; 5+ messages in thread
From: Glenn Morris @ 2016-06-01  6:36 UTC (permalink / raw)
  To: Ernesto Alfonso; +Cc: 23667

Ernesto Alfonso wrote:

> (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".

(length out) = 325969

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

[:space:] matches characters with whitespace syntax, and syntax is
buffer-local and varies between major modes. If you don't want that,
replace [:space:] with the exact characters you want to match.






^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#23667: 24.4; "Stack overflow in regexp matcher" happens in only some buffers, for the same arguments
  2016-06-01  6:36 ` Glenn Morris
@ 2016-06-01 14:42   ` Ernesto Alfonso
  2016-06-01 17:44     ` Glenn Morris
  2016-06-04  8:42     ` Eli Zaretskii
  0 siblings, 2 replies; 5+ messages in thread
From: Ernesto Alfonso @ 2016-06-01 14:42 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 23667

Hi,

I wasn't aware that [:space:] could vary by buffer. I replaced with
the exact character class I want and I'm no longer getting the stack
overflow.

Feel free to close this report as a mistake on my end. Though ideally
string-match shouldn't crash for that length of input, I could see
easily users working with buffers of that size.

Thanks,

Ernesto

On 5/31/16, Glenn Morris <rgm@gnu.org> wrote:
> Ernesto Alfonso wrote:
>
>> (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".
>
> (length out) = 325969
>
>> The evaluation should be independent of the buffer since no buffer
>> contents should be involved.
>
> [:space:] matches characters with whitespace syntax, and syntax is
> buffer-local and varies between major modes. If you don't want that,
> replace [:space:] with the exact characters you want to match.
>
>





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#23667: 24.4; "Stack overflow in regexp matcher" happens in only some buffers, for the same arguments
  2016-06-01 14:42   ` Ernesto Alfonso
@ 2016-06-01 17:44     ` Glenn Morris
  2016-06-04  8:42     ` Eli Zaretskii
  1 sibling, 0 replies; 5+ messages in thread
From: Glenn Morris @ 2016-06-01 17:44 UTC (permalink / raw)
  To: Ernesto Alfonso; +Cc: 23667


I didn't look in detail, but it's not the length of the input per se
that's the problem, so I should not have mentioned that. It's what the
regexp tries to match - presumably it ends up with some very long
multiline thing.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#23667: 24.4; "Stack overflow in regexp matcher" happens in only some buffers, for the same arguments
  2016-06-01 14:42   ` Ernesto Alfonso
  2016-06-01 17:44     ` Glenn Morris
@ 2016-06-04  8:42     ` Eli Zaretskii
  1 sibling, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2016-06-04  8:42 UTC (permalink / raw)
  To: Ernesto Alfonso; +Cc: 23667

> Date: Wed, 1 Jun 2016 07:42:53 -0700
> From: Ernesto Alfonso <erjoalgo@gmail.com>
> Cc: 23667@debbugs.gnu.org
> 
> ideally string-match shouldn't crash for that length of input

It didn't crash.  It detected that it ran out of stack space, and
recovered with an error message.

Thanks.





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-06-04  8:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-01  2:41 bug#23667: 24.4; "Stack overflow in regexp matcher" happens in only some buffers, for the same arguments Ernesto Alfonso
2016-06-01  6:36 ` Glenn Morris
2016-06-01 14:42   ` Ernesto Alfonso
2016-06-01 17:44     ` Glenn Morris
2016-06-04  8:42     ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).