Stack overflow problem when validating PPTX-file


When validating some PPTX-files, the recursive method GetRelationships(PackagePart part_) throws a StackOverflow-exception when getting relationships for the root document /ppt/presentation.xml .
Possible cause is a relationship referring "up" in the packace causing an infinite loop.
Maybe the recursive function is not a good idea?
Closed Mar 4, 2010 at 6:35 AM by jlundstocholm


jlundstocholm wrote Mar 4, 2010 at 6:24 AM

It is indeed caused by relationships pointing "backwards". In this case. the slidemaster is located at /ppt/slideMasters/slideMaster1.xml has this relationship:

<Relationship Id="rId8" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout" Target="../slideLayouts/slideLayout8.xml" />

And the slideLayout8.xml has this relationship:

<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster" Target="../slideMasters/slideMaster1.xml" />

An approach would be to keep the recursive method call but to avoid re-iterating over parts/relationships already dealt with. This should be based by absolute URI within the package.

wrote Mar 4, 2010 at 6:34 AM

wrote Mar 4, 2010 at 6:35 AM

Resolved with changeset 44174.

jlundstocholm wrote Mar 4, 2010 at 6:36 AM

Bug has been fixed by checking that a specific relationship is not checked twice.

wrote Feb 1, 2013 at 12:01 AM

wrote May 13, 2013 at 6:29 PM