Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

segfault on pikepdf.open(bin_stream) for some pdf's #10

Closed
wv0m56 opened this issue Oct 5, 2018 · 4 comments
Closed

segfault on pikepdf.open(bin_stream) for some pdf's #10

wv0m56 opened this issue Oct 5, 2018 · 4 comments

Comments

@wv0m56
Copy link

wv0m56 commented Oct 5, 2018

Failed with segfault:

f = open("Accessible EPUB 3.pdf", "rb")
doc = pikepdf.open(f)
for page in doc.pages:
    page.Rotate = 180
doc.save('test-rotated.pdf')

OK:

doc = pikepdf.open("Accessible EPUB 3.pdf")
for page in doc.pages:
    page.Rotate = 180
doc.save('test-rotated.pdf')

Other tests:
binary stream open (first snippet above) on tests/resources/pal-1bit-trivial.pdf -- OK (even though result is just a blank page)
my ebook collection |> "PathLike" open (second) snippet |> binary stream open snippet -- OK
my ebook collection |> binary stream open -- failed
my ebook collection |> various qpdf cli commands -- OK

On another note, the front page mentions "Commercial support is available" but I can't find any info about this anywhere. Do you have a pointer on this?

Thanks

@jbarlow83
Copy link
Member

jbarlow83 commented Oct 5, 2018

Thank you for this report. Any segfault is a serious concern.

I can't reproduce it but I'm fairly sure it's a memory use-after-free issue and I might be able to solve it without reproducing it. But in the interest of reproducing, what platform are you on, and are you using pikepdf from a wheel or did you build a version?

Regarding commercial support - contact me at jim@purplerock.ca and tell me a little about your project and requirements.

@wv0m56
Copy link
Author

wv0m56 commented Oct 5, 2018

IIRC I installed using pip.
I can reproduce the problem using the following: http://www.planetpdf.com/planetpdf/pdfs/pdf2k/01W/rosenthol_intro2pdfprog.pdf

Platform:

$ cat /etc/os-release 
NAME="Ubuntu"
VERSION="18.04.1 LTS (Bionic Beaver)"
$ pip3 list | grep pikepdf
pikepdf                       0.3.4
$ python3 -V
Python 3.6.6

Thank you for the info on commercial support. I'm still evaluating my options so no promises. I'll email you if I decide to go further in this direction.

@jbarlow83
Copy link
Member

Should be fixed in v0.3.5/master... still can't reproduce, but I'm pretty sure I fixed it.

@wv0m56
Copy link
Author

wv0m56 commented Oct 6, 2018

Since you can't reproduce it, I just want to let you know that the fix works. Thanks a lot!
(I hope I don't reopen the issue)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants