pdf.GetBookmarks and stack overflow

Discuss PDF file handling with the Polybios plugin here
Post Reply
User avatar
jPV
Posts: 283
Joined: Sat Mar 26, 2016 10:44 am
Location: RNO
Contact:

pdf.GetBookmarks and stack overflow

Post by jPV » Sat Jul 13, 2019 11:33 am

I get stack overflow error when trying to get bookmarks from some PDF files.
For example with this PDF: PDFReference.pdf
And this code:

Code: Select all

@REQUIRE "polybios", {Version=1, Revision=1}
pdf.OpenDocument(1, "PDFReference.pdf")
t=pdf.GetBookmarks(1)
This happens on both MorphOS and Windows, and increasing stack in shell didn't seem to help on MorphOS.

For some reason, disabling Hollywood's internal error handling lets me to continue with RNOPDF and I get the document opened by reloading it after the initial error, but I'm not sure why it works then and is it safe to do that? Weird thing is that I haven't been able to reproduce the error skipping with a simple script yet, it always exits even if I disable the error handling..... why on earth it does work with my bigger program?

User avatar
airsoftsoftwair
Posts: 3221
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: pdf.GetBookmarks and stack overflow

Post by airsoftsoftwair » Sun Jul 14, 2019 4:39 pm

This is not related to the shell stack but to the VM stack. The reason why it didn't occur in the bigger problem in the same way as in the smaller script is probably due to the fact that the larger script does something that makes the VM grow its stack which prevents the error from triggering then. Anyway, it's fixed now.

Code: Select all

- Fix: pdf.GetBookmarks() didn't make sure that there was enough stack space for the bookmark table

Post Reply