Skip to content

BUG: searching for "\{\}" string crashed Emacs #2014

@sfavazza

Description

@sfavazza

Emacs version: 29.4 (happens also on 30.1)
Evil version: 729d9a5
Whether you use Emacs/Evil in X mode or in terminal mode: observed on both X and terminal
Whether you use Emacs/Evil in terminal mode with some terminal multiplexer like tmux or screen (and see below): plain system terminal

The bug has been reproduced with just the evil package enabled and following configuration:

(use-package evil                                                                                                                                                                                                                             
;; :ensure t                                                                                                                                                                                                                                
:init
;; key-bindings and other behavior                                                                                                                                                                                                          
(setq evil-want-C-w-delete nil        ; do not delete in <insert-state>                                                                                                                                                                           
evil-want-C-i-jump nil          ; disable evil-jump-forward, disturb w/ org-cycle & forward-button                                                                                                                                          
evil-want-C-u-scroll t          ; disable universal arg in <normal-state>                                                                                                                                                                   
evil-want-Y-yank-to-eol t       ; exclude \n when yanking with Y, include \n w/ y-y instead                                                                                                                                                 
evil-disable-insert-state-bindings t) ; disable <insert-state> binding (preserve Emacs ones)                                                                                                                                          
;; search                                                                                                                                                                                                                                   
(setq evil-search-module 'evil-search                                                                                                                                                                                                             
evil-ex-visual-char-range t    ; only substitute within the selected region (no full line expansion)                                                                                                                                        
evil-symbol-word-search t)      ; search for symbols rather than for words                                                                                                                                                            
;; cursor display                                                                                                                                                                                                                           
(setq evil-move-cursor-back nil       ; quitting <insert-state> do not step one char backward                                                                                                                                                     
evil-v$-excludes-newline t      ; `$' will NOT include the EOL char, hence `v$y' consistent with `y$'                                                                                                                                       
evil-cross-lines t)             ; f,F,t,T can cross the line boundary                                                                                                                                                                 
;; NOTE: this is required before loading `evil' and/or `evil-collection' (which is forced to start AFTER                                                                                                                                    
;; `evil').                                                                                                                                                                                                                                 
(setq evil-want-integration t)                                                                                                                                                                                                              
(setq evil-want-keybinding nil)                                                                                                                                                                                                             
(setq evil-want-minibuffer t)                                                                                                                                                                                                               
:config                                                                                                                                                                                                                                     
(evil-mode 1))

How to reproduce

  • set any buffer in normal-state
  • start a search typing /
  • insert the string \{\}

As soon as the closing curly brace is inserted, Emacs crushes and spits out the following backtrace:

../../emacs-sources/emacs-29.4/src/regex-emacs.c:2488: Emacs fatal error: assertion failed: p > pattern && p[-1] == '\\'
Fatal error 6: Aborted
Backtrace:
emacs(+0x1f2df1)[0x61b75d3c0df1]
emacs(+0x5a2bf)[0x61b75d2282bf]
emacs(+0x61ff6)[0x61b75d22fff6]
emacs(+0x61dce)[0x61b75d22fdce]
emacs(+0x231e6a)[0x61b75d3ffe6a]
emacs(+0x237ee3)[0x61b75d405ee3]
emacs(+0x238695)[0x61b75d406695]
emacs(+0x238a05)[0x61b75d406a05]
/home/esrv/.emacs.d/eln-cache/29.4-3e3ddb78/evil-search-ff061bb6-f8106721.eln(F6576696c2d65782d7365617263682d66696e642d6e6578742d7061747465726e_evil_ex_search_find_next_pattern_0+0x3bd)[0x7eff28e6054d]
emacs(+0x27f202)[0x61b75d44d202]
/home/esrv/.emacs.d/eln-cache/29.4-3e3ddb78/evil-search-ff061bb6-f8106721.eln(F6576696c2d65782d66696e642d6e657874_evil_ex_find_next_0+0x25a)[0x7eff28e6128a]
emacs(+0x27f202)[0x61b75d44d202]
emacs(+0x27f7ec)[0x61b75d44d7ec]
emacs(+0x2d960b)[0x61b75d4a760b]
emacs(+0x27f202)[0x61b75d44d202]
/home/esrv/.emacs.d/eln-cache/29.4-3e3ddb78/evil-search-ff061bb6-f8106721.eln(F6576696c2d65782d7365617263682d66756c6c2d7061747465726e_evil_ex_search_full_pattern_0+0x2d5)[0x7eff28e61d85]
emacs(+0x27f202)[0x61b75d44d202]
/home/esrv/.emacs.d/eln-cache/29.4-3e3ddb78/evil-search-ff061bb6-f8106721.eln(F6576696c2d65782d7365617263682d7570646174652d7061747465726e_evil_ex_search_update_pattern_0+0x3fe)[0x7eff28e6284e]
emacs(+0x27f202)[0x61b75d44d202]
emacs(+0x27f8a0)[0x61b75d44d8a0]
emacs(+0x27f202)[0x61b75d44d202]
/home/esrv/emacsinstall/bin/../lib/emacs/29.4/native-lisp/29.4-3e3ddb78/preloaded/timer-3ee7cfd9-226b3dc9.eln(F74696d65722d6576656e742d68616e646c6572_timer_event_handler_0+0x407)[0x7eff2bee51e7]
emacs(+0x27f202)[0x61b75d44d202]
emacs(+0x1d3f79)[0x61b75d3a1f79]
emacs(+0x1d448d)[0x61b75d3a248d]
emacs(+0x1d4694)[0x61b75d3a2694]
emacs(+0x1d4739)[0x61b75d3a2739]
emacs(+0x8611f)[0x61b75d25411f]
emacs(+0x1dc889)[0x61b75d3aa889]
emacs(+0x1ddf70)[0x61b75d3abf70]
emacs(+0x1e02b1)[0x61b75d3ae2b1]
emacs(+0x27ce76)[0x61b75d44ae76]
emacs(+0x1c5c3e)[0x61b75d393c3e]
emacs(+0x27cdad)[0x61b75d44adad]
emacs(+0x1c6423)[0x61b75d394423]
emacs(+0x1d0889)[0x61b75d39e889]
emacs(+0x2137e1)[0x61b75d3e17e1]
emacs(+0x2148a8)[0x61b75d3e28a8]
emacs(+0x27f202)[0x61b75d44d202]
/home/esrv/.emacs.d/eln-cache/29.4-3e3ddb78/evil-search-ff061bb6-f8106721.eln(F6576696c2d65782d73746172742d736561726368_evil_ex_start_search_0+0x78d)[0x7eff28e63b8d]
emacs(+0x27f202)[0x61b75d44d202]
/home/esrv/.emacs.d/eln-cache/29.4-3e3ddb78/evil-commands-bd8cc17a-93b18714.eln(F6576696c2d65782d7365617263682d666f7277617264_evil_ex_search_forward_0+0x3b)[0x7eff28dc79bb]
emacs(+0x27f202)[0x61b75d44d202]
emacs(+0x279222)[0x61b75d447222]
emacs(+0x27f202)[0x61b75d44d202]
emacs(+0x27f911)[0x61b75d44d911]
emacs(+0x27a184)[0x61b75d448184]
/home/esrv/emacsinstall/bin/../lib/emacs/29.4/native-lisp/29.4-3e3ddb78/preloaded/simple-fab5b0cf-7c10fc4e.eln(F636f6d6d616e642d65786563757465_command_execute_0+0x2e5)[0x7eff2c412a35]
emacs(+0x27f202)[0x61b75d44d202]
emacs(+0x1e0699)[0x61b75d3ae699]
emacs(+0x27ce76)[0x61b75d44ae76]
emacs(+0x1c5c3e)[0x61b75d393c3e]
emacs(+0x27cdad)[0x61b75d44adad]
emacs(+0x1c64bd)[0x61b75d3944bd]
emacs(+0x1d0889)[0x61b75d39e889]
emacs(+0x1d0f44)[0x61b75d39ef44]
emacs(+0x778ef)[0x61b75d2458ef]
/lib/x86_64-linux-gnu/libc.so.6(+0x29d90)[0x7eff308d6d90]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80)[0x7eff308d6e40]
emacs(+0x78ba5)[0x61b75d246ba5]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions