PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Mar 28, 2024 3:24 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



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

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

http://www.stillhq.com/pdfdb/000590/data.pdf causes pdfsharp to loop infinitely until it runs out of memory.

Cause:

Because of http://forum.pdfsharp.net/viewtopic.php?f=3&t=3410, pdfsharp fails to emit a closing parenthesis in a content stream. Then, the scanning for the end of the string results in an infinite loop.

Regardless of the previous bug, a missing end-of-string parenthesis should never result in an infinite loop.

Patch:

See attachment. Patch is against 1.50-beta3b. Note: I constructed the diff partially by hand, because CLexer.cs was inadvertently stored as UTF-16 in our local repository. I hope I made no mistakes.

The patch also fixes an error message.


Attachments:
pdfsharp-672.zip [990 Bytes]
Downloaded 496 times

_________________
Gerben Vos
Developer
Top
 Profile  
Reply with quote  
PostPosted: Tue Aug 09, 2016 1:33 pm 
Offline

Joined: Tue Aug 02, 2016 9:56 am
Posts: 40
Location: Amsterdam, The Netherlands
This program, based on the issue submission template, is enough to reproduce the problem, also for the other issues I posted. PDF files are not included; they are linked in the issues themselves.


Attachments:
PDFsharp-IssueSubmission (2).zip [14.77 KiB]
Downloaded 489 times

_________________
Gerben Vos
Developer
Top
 Profile  
Reply with quote  
PostPosted: Mon Aug 15, 2016 2:08 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3095
Location: Cologne, Germany
Thanks for the feedback.

I think we already fixed that endless loop issue. Using the latest internal build, I cannot replicate the problem.

With respect to "cast" vs. "casted", I didn't change the comments as I consider "casted" correct in the context:
http://english.stackexchange.com/a/94570

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Mon Aug 15, 2016 2:37 pm 
Offline

Joined: Tue Aug 02, 2016 9:56 am
Posts: 40
Location: Amsterdam, The Netherlands
Okay, in that case I'm looking forward to a new public build, as I'm sure are many others...

I did a quick scan of all while loops in the source, and found about 10 that looked somewhat suspicious, but in that case I guess I'll hold off with further tests in that area unless we hit on a problematic PDF again.

Please note that, apart from that unimportant change in two comments, I also fixed the format string of an error message.

_________________
Gerben Vos
Developer


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 40 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