Subject: [xml2rfc] #267 (Version 2 cli): Infinite loop when word-joiner is present

From: "xml2rfc issue tracker" <[email-masked]>
Date: Fri, 04 Jul 2014 06:53:54 -0000

#267: Infinite loop when word-joiner is present

 xml2rfc v2.4.8 goes into an infinite loop when certain illegal characters,
 specifically &wj; (either word joiner or an unrecognized entity
 reference), are present.

 For example, with the attached XML file, if the following text is present
 around line 78:
 ldap:/&wj;/&wj;/&wj;cn=ExampleCA,o=ExampleCo,st=California,c=US

 Then, the following output will come out of xml2rfc:

 {{{
 WARNING: Illegal character replaced in string:
 WARNING: Illegal character replaced in string:
 …(continues until process killed)
 WARNING: Illegal character replaced in string:
 ^CTraceback (most recent call last):
   File "/usr/local/bin/xml2rfc", line 225, in <module>
     main()
   File "/usr/local/bin/xml2rfc", line 210, in main
     pagedwriter.write(filename)
   File "~/Library/Python/2.7/lib/python/site-
 packages/xml2rfc-2.4.8-py2.7.egg/xml2rfc/writers/base.py", line 1173, in
 write
     xml2rfc.utils.safeReplaceUnicode(self.r)
   File "~/Library/Python/2.7/lib/python/site-
 packages/xml2rfc-2.4.8-py2.7.egg/xml2rfc/utils.py", line 301, in
 safeReplaceUnicode
     element.text = _replace_unicode_characters(element.text)
   File "~/Library/Python/2.7/lib/python/site-
 packages/xml2rfc-2.4.8-py2.7.egg/xml2rfc/utils.py", line 326, in
 _replace_unicode_characters
     entity = match.group(1).encode('ascii', 'xmlcharrefreplace')
 }}}

 Therefore, it appears that something is going wrong in
 _replace_unicode_characters in utils.py.

 This infinite loop condition seems to appear both in a locally executed
 version, and on xml2rfc.ietf.org.

-- 
----------------------------------+----------------------------------
 Reporter:  [email-masked]  |      Owner:  [email-masked]
     Type:  defect                |     Status:  new
 Priority:  medium                |  Milestone:
Component:  Version 2 cli         |    Version:  2.4.x
 Keywords:                        |
----------------------------------+----------------------------------

Ticket URL: <https://trac.tools.ietf.org/tools/xml2rfc/trac/ticket/267>
xml2rfc <http://tools.ietf.org/tools/xml2rfc/>