PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Tue Mar 19, 2024 8:52 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Thu Aug 04, 2016 2:26 pm 
Offline

Joined: Tue Aug 02, 2016 9:56 am
Posts: 40
Location: Amsterdam, The Netherlands
What happens:

http://www.stillhq.com/pdfdb/000419/data.pdf (which is corrupt) causes pdfsharp to hang in an infinite loop.

Cause:

A content stream inside 000419.pdf specifies a length that is longer than the file itself.

After reading a stream, pdfsharp will look for the endstream token. This loop does not exit if the file pointer is at or past the end of the file.

Patch:

See attachment. Patch is against PdfSharp 1.50-beta3b.


Attachments:
pdfsharp-670.zip [561 Bytes]
Downloaded 561 times

_________________
Gerben Vos
Developer
Top
 Profile  
Reply with quote  
PostPosted: Thu Aug 04, 2016 2:35 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3092
Location: Cologne, Germany
Hi!

Thanks for the submission. Changes look good at first glance.

I will give them a close look on Monday.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Thu Aug 04, 2016 3:27 pm 
Offline

Joined: Tue Aug 02, 2016 9:56 am
Posts: 40
Location: Amsterdam, The Netherlands
We found a few problems while running a huge batch of PDFs from our clients through PdfSharp. For now, these are the most urgent problems we found (having the process hang is pretty terrible). I hope to find some time to look at the remaining problems soon (the LZW decompression bug looks like the worst of those, but there are more).

_________________
Gerben Vos
Developer


Last edited by Gerben Vos on Thu Aug 04, 2016 3:30 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
PostPosted: Thu Aug 04, 2016 3:28 pm 
Offline

Joined: Tue Aug 02, 2016 9:56 am
Posts: 40
Location: Amsterdam, The Netherlands
In general, I can recommend downloading all of this PDF database and running it through PdfSharp; this should already show up a bunch of problems: http://www.stillhq.com/pdfdb/db.html .

_________________
Gerben Vos
Developer


Top
 Profile  
Reply with quote  
PostPosted: Tue Aug 16, 2016 12:22 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3092
Location: Cologne, Germany
Thanks for the patch and the link to the PDF DB.

That's an interesting file.
Adobe Reader says the file is corrupt and shows an empty page.
The PDF Reader from Windows 10 shows an empty page without complaining.
The Edge that comes with Windows 10 shows a page full with letter "X" without complaining.
Does that mean that Microsoft included two different PDF viewers in Windows 10 that use different code?

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group