]> git.eshelyaron.com Git - emacs.git/commitdiff
Avoid invalid regexp in wide docstring check
authorBasil L. Contovounesios <contovob@tcd.ie>
Tue, 6 Jul 2021 00:05:41 +0000 (01:05 +0100)
committerBasil L. Contovounesios <contovob@tcd.ie>
Tue, 6 Jul 2021 17:56:15 +0000 (18:56 +0100)
* lisp/emacs-lisp/bytecomp.el (byte-compile--wide-docstring-p):
Avoid constructing an invalid regexp during byte-compilation by
limiting the number of columns to the current RE_DUP_MAX of 65535.
This protects against pathological values of fill-column, for
example (bug#49426).

lisp/emacs-lisp/bytecomp.el

index 70999648d47eb43461837623c221a906b216b489..6970c8a5055e8eedc6daea35012f5d63547cb071 100644 (file)
@@ -1627,7 +1627,7 @@ the `\\\\=[command]' ones that are assumed to be of length
 `byte-compile--wide-docstring-substitution-len'.  Also ignore
 URLs."
   (string-match
-   (format "^.\\{%s,\\}$" (int-to-string (1+ col)))
+   (format "^.\\{%d,\\}$" (min (1+ col) #xffff)) ; Heed RE_DUP_MAX.
    (replace-regexp-in-string
     (rx (or
          ;; Ignore some URLs.