bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#61514: 30.0.50; sadistically long xml line hangs emacs


From: Gregory Heytings
Subject: bug#61514: 30.0.50; sadistically long xml line hangs emacs
Date: Mon, 20 Feb 2023 17:04:08 +0000



I don't think it's this regexp which causes the overflow.


... but with a larger buffer it does, so apparently the regexp is problematic after all:

(with-current-buffer (get-buffer-create "*bug*")
  (let ((regexp "\\(\\(?:\\(xmlns\\)\\|[_[:alpha:]][-._[:alnum:]]*\\)\\(:[_[:alpha:]][-._[:alnum:]]*\\)?\\)[ \r\t\n]*=\\(?:[ 
\r\t\n]*\\('[^<'&\r\n\t]*\\([&\r\n\t][^<']*\\)?'\\|\"[^<\"&\r\n\t]*\\([&\r\n\t][^<\"]*\\)?\"\\)\\(?:\\([
 \r\t\n]*>\\)\\|\\(?:\\([ \r\t\n]*/\\)\\(>\\)?\\)\\|\\([ \r\t\n]+\\)\\)\\)?"))
    (erase-buffer)
    (insert "<id name=\"")
    (insert (make-string  266659 ?n))
    (goto-char 5)
    (looking-at regexp)))

Here 266658 does not overflow, and 266659 does. If '=' is removed from the regexp it doesn't overflow anymore, even with a much larger string.

Trying to simplify the regexp gradually, I finally obtained the following minimal test case:

(with-current-buffer (get-buffer-create "*bug*")
  (let ((regexp "[[:alpha:]]*=\".*&.*\""))
    (erase-buffer)
    (insert "<id name=\"")
    (insert (make-string  266666 ?n))
    (goto-char 5)
    (looking-at regexp)))

Here it fails with 266666, and doesn't with 266665.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]