Avoid slowdowns in xmltok-scan-attributes
* lisp/nxml/xmltok.el (xmltok-scan-attributes): Limit the search to 10000 characters, to avoid slowdowns due to the quadratic complexity of the regexp. Suggested by Stefan Monnier.
This commit is contained in:
parent
647c6bf2a6
commit
0eddfa28eb
1 changed files with 7 additions and 2 deletions
|
@ -734,8 +734,13 @@ and VALUE-END, otherwise a STRING giving the value."
|
||||||
(atts-needing-normalization nil))
|
(atts-needing-normalization nil))
|
||||||
(while (cond ((or (looking-at (xmltok-attribute regexp))
|
(while (cond ((or (looking-at (xmltok-attribute regexp))
|
||||||
;; use non-greedy group
|
;; use non-greedy group
|
||||||
(when (looking-at (concat "[^<>\n]+?"
|
;; Limit the search to 10000 characters, to
|
||||||
(xmltok-attribute regexp)))
|
;; avoid slowdowns due to the quadratic
|
||||||
|
;; complexity of the regexp. See bug#61514.
|
||||||
|
(when (with-restriction
|
||||||
|
(point) (+ (point) 10000)
|
||||||
|
(looking-at (concat "[^<>\n]+?"
|
||||||
|
(xmltok-attribute regexp))))
|
||||||
(unless recovering
|
(unless recovering
|
||||||
(xmltok-add-error "Malformed attribute"
|
(xmltok-add-error "Malformed attribute"
|
||||||
(point)
|
(point)
|
||||||
|
|
Loading…
Add table
Reference in a new issue