Measure Path fails with "XML too deep" error

Bug #1217602 reported by dave m. on 2013-08-27
This bug affects 1 person
Affects Status Importance Assigned to Milestone
dave m.

Bug Description

Error message isn't quite right, but that's the gist. I solved it with the following patch to

*** 2012-12-29 14:03:29.000000000 -0800
--- 2013-08-27 15:06:39.339886770 -0700
*** 136,142 ****
                  stream = open(self.svg_file,'r')
              stream = sys.stdin
! self.document = etree.parse(stream)

      def getposinlayer(self):
--- 136,143 ----
                  stream = open(self.svg_file,'r')
              stream = sys.stdin
! p = etree.XMLParser(huge_tree=True)
! self.document = etree.parse(stream,parser=p)

      def getposinlayer(self):

Alvin Penner (apenner) wrote :

could you attach the file that caused the crash?

Attached. Also, I reverted to the original and copied the error message:

Traceback (most recent call last):
  File "", line 198, in <module>
  File "/usr/share/inkscape/extensions/", line 211, in affect
  File "/usr/share/inkscape/extensions/", line 139, in parse
    self.document = etree.parse(stream)
  File "lxml.etree.pyx", line 2953, in lxml.etree.parse (src/lxml/lxml.etree.c:56204)
  File "parser.pxi", line 1555, in lxml.etree._parseDocument (src/lxml/lxml.etree.c:82511)
  File "parser.pxi", line 1585, in lxml.etree._parseFilelikeDocument (src/lxml/lxml.etree.c:82832)
  File "parser.pxi", line 1468, in lxml.etree._parseDocFromFilelike (src/lxml/lxml.etree.c:81688)
  File "parser.pxi", line 1024, in lxml.etree._BaseParser._parseDocFromFilelike (src/lxml/lxml.etree.c:78735)
  File "parser.pxi", line 569, in lxml.etree._ParserContext._handleParseResultDoc (src/lxml/lxml.etree.c:74472)
  File "parser.pxi", line 650, in lxml.etree._handleParseResult (src/lxml/lxml.etree.c:75363)
  File "parser.pxi", line 590, in lxml.etree._raiseParseError (src/lxml/lxml.etree.c:74696)
lxml.etree.XMLSyntaxError: Excessive depth in document: 256 use XML_PARSE_HUGE option, line 2369, column 33

Oh, you know what? I just remembered, the basic SVG file was converted from a PDF. Even though the path I'm trying to measure is just a 6-point figure on a separate layer, I bet the PDF->SVG conversion made a hairy document. That would explain why such a simple file is still 1.2MB. PDF document attached here...

Alvin Penner (apenner) on 2013-08-28
Changed in inkscape:
status: New → Confirmed
Alvin Penner (apenner) wrote :

thanks for the pdf file, I was just about to request that...
original crash confirmed on Windows XP, Inkscape rev 12472.

It is true that the Python code is crashing, however, the original culprit appears to be the pdf import, which is generating a large number of redundant nested groups.

su_v (suv-lp) wrote :

Related (same issue with Inkscape's own internal parser, fixed in trunk and stable):
- Bug #297070 “depth of xmlParserMaxDepth insufficient”

tags: added: extensions-plugins
jazzynico (jazzynico) wrote :

Patch tested successfully on Windows XP, Inkscape trunk revision 12506.
Additional tests planned on Debian later.

Changed in inkscape:
assignee: nobody → dave m. (z-launchpad-mersenne-com)
importance: Undecided → Low
milestone: none → 0.49
status: Confirmed → In Progress
tags: added: backport-proposed
jazzynico (jazzynico) wrote :

Fixed in the trunk revision 12526.
Thanks for the patch, Dave!

Changed in inkscape:
status: In Progress → Fix Committed
su_v (suv-lp) wrote :

Setting milestone to 0.48.5 so that we don't forget to backport.

Changed in inkscape:
milestone: 0.49 → 0.48.5
status: Fix Committed → In Progress
su_v (suv-lp) wrote :

Backported to lp:inkscape/0.48.x in revision 9958.

Changed in inkscape:
status: In Progress → Fix Committed
Kris (kris-degussem) on 2013-12-11
tags: removed: backport-proposed
Changed in inkscape:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers