diff options
author | Chong Yidong <cyd@stupidchicken.com> | 2010-06-30 16:34:06 -0400 |
---|---|---|
committer | Chong Yidong <cyd@stupidchicken.com> | 2010-06-30 16:34:06 -0400 |
commit | 01b229d127055ee20a38a1461b29533689e77543 (patch) | |
tree | f1f6047bf6c7779feecdff1ef4d3247fb8c8b4e9 /lisp/xml.el | |
parent | 3d8416fce94a69c96e1819ddf0e40ad759cec9a3 (diff) |
* xml.el (xml-parse-region): Avoid infloop (Bug#5281).
Diffstat (limited to 'lisp/xml.el')
-rw-r--r-- | lisp/xml.el | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/lisp/xml.el b/lisp/xml.el index 20b595fd2d..8e8981ac43 100644 --- a/lisp/xml.el +++ b/lisp/xml.el @@ -321,18 +321,20 @@ If PARSE-NS is non-nil, then QNAMES are expanded." (progn (forward-char -1) (setq result (xml-parse-tag parse-dtd parse-ns)) - (if (and xml result (not xml-sub-parser)) - ;; translation of rule [1] of XML specifications - (error "XML: (Not Well-Formed) Only one root tag allowed") - (cond - ((null result)) - ((and (listp (car result)) - parse-dtd) - (setq dtd (car result)) - (if (cdr result) ; possible leading comment - (add-to-list 'xml (cdr result)))) - (t - (add-to-list 'xml result))))) + (cond + ((null result) + ;; Not looking at an xml start tag. + (forward-char 1)) + ((and xml (not xml-sub-parser)) + ;; Translation of rule [1] of XML specifications + (error "XML: (Not Well-Formed) Only one root tag allowed")) + ((and (listp (car result)) + parse-dtd) + (setq dtd (car result)) + (if (cdr result) ; possible leading comment + (add-to-list 'xml (cdr result)))) + (t + (add-to-list 'xml result)))) (goto-char (point-max)))) (if parse-dtd (cons dtd (nreverse xml)) |