GNOME Bugzilla – Bug 778769
lisbxml crashes on iOS for XML with "comment" element
Last modified: 2017-02-16 22:11:28 UTC
Created attachment 345951 [details] Stack trace on iOS Hi, we are building an iOS app (using iOS 10 and Xcode 8.2). Tis app use XSLT to transform XML file into HTML content. HTML generated content are displayed using UIWebViews . Everything works fine, even with very large files, but recently we are experiencing a crash, with some XML files. After some research, it appears that the crash happens when we use a specific markup : <comment><unlist>....</unlist></comment> (see attach file for crash report). If this section is remove, everything works fine. Any help on this would be really appreciated. Regards Michel ----- here is an example of this code : <?xml version="1.0" encoding="UTF-8"?> <ecaminopsys layer="1" lid="F.00018546.0011001.031"> <allphase-sys code="00018546.0011001.023" layer="1" lid="F.00018546.0011001.032"> <sys ecam="true" ecamimportance="A" lid="F.00018546.0011001.033"> TEXT </sys> <sys ecam="true" ecamimportance="A" lid="F.00018546.0011001.034"> TEXT </sys> <sys ecam="true" ecamimportance="A" lid="F.00018546.0011001.035"> TEXT </sys> <sys ecam="true" ecamimportance="A" lid="F.00018546.0011001.036"> TEXT </sys> <sys ecam="true" ecamimportance="A" lid="F.00018546.0011001.037"> TEXT </sys> <sys ecam="true" ecamimportance="A" lid="F.00018546.0011001.038"> TEXT </sys> <sys ecam="true" ecamimportance="A" lid="F.00018546.0011001.039"> TEXT </sys> <sys ecam="true" ecamimportance="A" lid="F.00018546.0011001.040"> TEXT </sys> <comment code="00018546.0011001.024"> <unlist bulltype="NDASH" code="00018546.0011001.025" layer="2" lid="F.00018546.0011001.041"> <para code="00018546.0011001.026" layer="2" lid="F.00018546.0011001.042"> TEXT <tech-label type="pb-sw">LAND RECOVERY</tech-label> TEXT </para> <item layer="2"> <para code="00018546.0011001.027" layer="2" lid="F.00018546.0011001.043"> TEXT <abb>LGCIU</abb> TEXT <abb>TEXT</abb> TEXT <abb> TEXT </abb> TEXT <abb> TEXT </abb> TEXT <abb> TEXT </abb> TEXT <abb> TEXT </abb> TEXT </para> </item> <item layer="2"> <para code="00018546.0011001.028" layer="2" lid="F.00018546.0011001.044"> TEXT <measure category="Weight" show-unit="true" system="SI and derived" unit="t">2</measure> TEXT </para> </item> <item layer="2"> <para code="00018546.0011001.029" layer="2" lid="F.00018546.0011001.045"> TEXT <abb> TEXT </abb> </para> </item> <item layer="2"> <para code="00018546.0011001.030" layer="2" lid="F.00018546.0011001.046"> <abb>TEXT</abb> TEXT TEXT <abb> TEXT </abb> TEXT <tech-label type="pb-sw"> TEXT </tech-label> TEXT </para> </item> </unlist> </comment> <sys ecam="true" ecamimportance="A" lid="F.00018546.0011001.047"> TEXT </sys> <sys ecam="true" ecamimportance="A" lid="F.00018546.0011001.048"> TEXT </sys> <sys ecam="true" ecamimportance="A" lid="F.00018546.0011001.049"> TEXT </sys> </allphase-sys> </ecaminopsys>
The stacktrace is huge, so this is probably a stack overflow caused by a recursive template. Your best option is to replace the recursive template with a non-recursive version or somehow limit the recursion depth. You can also set maxTemplateDepth in xsltTransformContext to a value lower than the default of 3000, and you'll get an error message instead of a crash. In your case, a value of 500 should work. *** This bug has been marked as a duplicate of bug 736077 ***