GNU bug report logs -
#7172
emacs 23.2; xml.el: xml-parse-file hangs when DOCTYPE element names contain _ (underscore)
Previous Next
Full log
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
In a DOCTYPE construction, whenever there's an ELEMENT name with an
underscore in its name, function xml-parse-file makes emacs become
unresponsive and use 100% cpu. Emacs recovers nicely with C-g but no
error is printed.
To reproduce this behavior I set up these two simple xml files:
------------ output --------------
$ cat example-good.xml
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE EXAMPLE [
<!ELEMENT EXAMPLE EMPTY>
]>
<EXAMPLE>
</EXAMPLE>
$ cat example-bad.xml
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE EXAMPLE [
<!ELEMENT EXAM_PLE EMPTY>
]>
<EXAM_PLE>
</EXAM_PLE>
------------ output --------------
Then from emacs I run:
(xml-parse-file "example-good.xml")
Which as expected produces:
((EXAMPLE nil "
"))
But when I do the same for the other file:
(xml-parse-file "example-bad.xml")
No output is produced and emacs becomes unresponsive.
Attaching strace to the running emacs process prints:
brk(0x267b000) = 0x267b000
brk(0x269d000) = 0x269d000
brk(0x2637000) = 0x2637000
brk(0x2659000) = 0x2659000
brk(0x267b000) = 0x267b000
brk(0x269d000) = 0x269d000
brk(0x2637000) = 0x2637000
brk(0x2659000) = 0x2659000
brk(0x267b000) = 0x267b000
brk(0x269d000) = 0x269d000
brk(0x2637000) = 0x2637000
brk(0x2659000) = 0x2659000
These messages repeat over and over.
I should mention that this behavior seems to be triggered by the
underscore in the DOCTYPE ELEMENT name, and is not affected by the
underscore in the actual element's name. Thus, this file also triggers
the bug:
$ cat example-bad2.xml
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE EXAMPLE [
<!ELEMENT EXAM_PLE EMPTY>
]>
<EXAMPLE>
</EXAMPLE>
This bug report was last modified 12 years and 326 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.