Page 1 of 1

pdf.GetBookmarks and stack overflow

Posted: Sat Jul 13, 2019 11:33 am
by jPV
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")
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?

Re: pdf.GetBookmarks and stack overflow

Posted: Sun Jul 14, 2019 4:39 pm
by airsoftsoftwair
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