Avoid stack level too deep when decrypting objects #209
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As demonstrated in the following file, a stack level too deep error seems possible in the
ObjectHash#decrypt
methodhttps://www.dropbox.com/s/4lvx469c580iuiv/pdf-reader%20decrypt%20stack%20overflow.pdf?dl=0
The stacktrace I got trying to access the first page (
pages.first
) was:This error was seen on v2.0.0 as well as master.
This PR probably shouldn't be merged directly. My intention was to demonstrate the error and take a basic pass at fixing it, but I'm not really sure what the
#decrypt
method does or what it's arguments represent. I mainly looked at #198 and tried to apply similar changes. I'm not sure how to come up with a minimal test case as you did in #198 to add to the test suite, or what exactly to test other than "doesn't error".Thanks for pdf-reader!