]> git.eshelyaron.com Git - emacs.git/commitdiff
; cperl-mode.el: prevent Emacs from "freezing" (Bug#70948)
authorHarald Jörg <haj@posteo.de>
Thu, 16 May 2024 20:22:37 +0000 (22:22 +0200)
committerEshel Yaron <me@eshelyaron.com>
Sat, 18 May 2024 18:51:45 +0000 (20:51 +0200)
* cperl-mode.el (defconst): Replace the rx expression for
`cperl--basic-identifier-rx' with its actual macro expansion.
This makes it efficient under Emacs 29.3, where the expansion
by rx.el could make Emacs freeze with a crafted Perl source
(Bug#70948).

(cherry picked from commit 54a7268763138fdc63bf81feca99013b01337872)

lisp/progmodes/cperl-mode.el

index 81ecb535b826fba599a02b6279d1e3fbcd034d5d..cbc23507fca84fab1ed6f498b601a9af2f08261f 100644 (file)
@@ -1178,7 +1178,12 @@ The expansion is entirely correct because it uses the C preprocessor."
 (eval-and-compile
 
   (defconst cperl--basic-identifier-rx
-    '(sequence (or alpha "_") (* (or word "_")))
+    ;; The rx expression in the following line is a workaround for
+    ;; bug#70948 under Emacs 29
+    '(regex "[_[:alpha:]][_[:word:]]*")
+    ;; The rx expression in the following line is equivalent but
+    ;; inefficient under Emacs 29.3
+    ;; '(sequence (or alpha "_") (* (or word "_")))
     "A regular expression for the name of a \"basic\" Perl variable.
 Neither namespace separators nor sigils are included.  As is,
 this regular expression applies to labels,subroutine calls where