From c63b207e4f251c9cbe3b4f4606b1f0e9e5f67978 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Fri, 26 Sep 2025 12:15:59 -0400 Subject: [PATCH] fix(evil): add error handling for :h[elp] ex command apropos throws up an arith-error trying to rank the results of matchless regexp (which can result in a segfault on some systems; see #8532), and is *incredibly* slow lookuping up short queries, so the command will now abort if the query is just a regexp operator or less than 3 characters long. Fix: #8532 --- modules/editor/evil/autoload/ex.el | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/editor/evil/autoload/ex.el b/modules/editor/evil/autoload/ex.el index 6610248a4..45be0b3df 100644 --- a/modules/editor/evil/autoload/ex.el +++ b/modules/editor/evil/autoload/ex.el @@ -182,6 +182,13 @@ non-nil, a search is preformed against Doom's manual (with (funcall (or (command-remapping #'describe-function) #'describe-function) (evil-ex-completed-binding (match-string 1 query)))) + ((or (string-match "^ *[^a-z0-9-_]$" query) + (condition-case nil + (ignore (string-match-p query "")) + (invalid-regexp t))) + (user-error "Invalid query: %S" query)) + ((< (string-width query) 3) + (user-error "Query too short (must be > 2 characters): %S" query)) ((message "Searching for %S, this may take a while..." query) (apropos query t))))))