From: Eshel Yaron Date: Fri, 28 Mar 2025 16:57:35 +0000 (+0100) Subject: ; (find-function-search-for-symbol): Be cautious with macros. X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f1fdfda925e57a123304a2d387218e704b478217;p=emacs.git ; (find-function-search-for-symbol): Be cautious with macros. --- diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el index 326232028e7..54e6cb30b87 100644 --- a/lisp/emacs-lisp/find-func.el +++ b/lisp/emacs-lisp/find-func.el @@ -539,10 +539,13 @@ The search is done in the source for library LIBRARY." ;; If the regexp search didn't find the location of ;; the symbol (for example, because it is generated by ;; a macro), try a slightly more expensive search that - ;; expands macros until it finds the symbol. + ;; expands macros until it finds the symbol. Since + ;; macro-expansion involves arbitrary code execution, + ;; only attempt it in trusted buffers. (cons (current-buffer) - (find-function--search-by-expanding-macros - (current-buffer) symbol type)))))))))) + (when (trusted-content-p) + (find-function--search-by-expanding-macros + (current-buffer) symbol type))))))))))) (defun find-function--try-macroexpand (form) "Try to macroexpand FORM in full or partially.