Interesting PDF bugs – an extreme case of recursion

PDF files have a very useful feature known as XForms, which are sub-procedures. This makes it very easy to reuse code and produce smaller files. XForms can be thought of as fragments of PDF pages in their own right, with their own images and fonts and other resources, which can then be drawn onto the main page. In general they also inherit data from the main page. So if the XForm makes a call to Font TT1, it sees if it is defined in the XForm and looks in its parent if not.

However, here is an interesting XForm. It loads ant XForm called xi0. And guess what xio does? It loads a form called xio… There is no local definition of xi0 – so we default back to the main definition of xio (and round we go).

Adobe reports an error in this file and it is reasonably easy to add a check to stop this, but it is very annoying…

The PDF file format is a very powerful format but with power comes responsibility.

This article is part of a series on the more ‘unusual’ PDF files we come across while developing our PDF library. Click here for the full list.

Related Posts:

The following two tabs change content below.

Mark Stephens

System Architect and Lead Developer at IDRSolutions
Mark Stephens has been working with Java and PDF since 1999 and has diversified into HTML5, SVG and JavaFX. He also enjoys speaking at conferences and has been a Speaker at user groups, Business of Software, Seybold and JavaOne conferences. He has a very dry sense of humor and an MA in Medieval History for which he has not yet found a practical use.
Markee174

About Mark Stephens

Mark Stephens has been working with Java and PDF since 1999 and has diversified into HTML5, SVG and JavaFX.

He also enjoys speaking at conferences and has been a Speaker at user groups, Business of Software, Seybold and JavaOne conferences. He has a very dry sense of humor and an MA in Medieval History for which he has not yet found a practical use.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>