On Thu, Jan 11, 2007 at 10:33:39AM -0500, Kristian Høgsberg wrote: > On 1/11/07, Jeff Muizelaar <[EMAIL PROTECTED]> wrote: > >On Thu, Jan 11, 2007 at 08:45:48AM -0500, Kristian Høgsberg wrote: > ... > >> And the problem in this case is how to prevent looping when we have > >> circular references in the page tree. To prevent this we can do two > >> things: the one idea that Albert doesn't like is to just limit the > >> depth of the page tree. We can either choose a fixed limit or use the > >> total number of references as a limit. If there is a page tree chain > >> longer than, say, 1000, the document is most certainly malicious. On > >> the other hand, we can easily handle a recusion level of 1000, so we > >> can detect it and bail out safely in that case. > >> > >> The other idea is to just put a 'visited' bit in each node of the page > >> tree. If wee see a page that already has the 'visited' bit set we > >> know something is wrong and we can bail out right away. > > > >I looked at this idea first. However, I didn't see how it could fit > >easily with the exisiting code structure. The solution I came with is to > >have a bitmap of size XRef->size(), then for each object we visit mark > >the bit corresponding to that object. If the bit is already set we know > >that we have a loop in the tree. > > But why not just limit the recursion depth to XRef->size() calls?
Didn't think of that. Sounds like that would work just fine as well, and should be even easier to implement. -Jeff _______________________________________________ poppler mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/poppler
