PDFsharp & MigraDoc Foundation

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

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 15 posts ] 
Author Message
PostPosted: Tue Jun 03, 2008 3:21 pm 
Offline

Joined: Tue Jun 03, 2008 3:13 pm
Posts: 1
The opening angle brackets of the follwoing subdictionary

Code:
<</Predictor 15
/Columns 8
/Colors 3>>


inside a content stream are falsely interpreted as the beginning of hexdecimal number. The result is that ScanHexadecimalString() of CLexer gets stuck in an infinite loop.

A possible solution to this problem might be to check at the beginning of ScanHexadecimalString() whether the NextChar is also '<'. If that's the case, ScanHexadecimalString() shouldn't continue.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Jun 04, 2008 7:49 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3095
Location: Cologne, Germany
That bug will be fixed with the next release (which is scheduled for summer 2008).

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Nov 25, 2008 8:49 pm 
Offline
User avatar

Joined: Tue Oct 14, 2008 6:15 pm
Posts: 32
Location: USA
Is there a fix for this issue? I took it upon myself to basically reinvent the wheel as far as paring content streams, but I'd rather not rely on regular expressions to do all my heavy lifting. Thanks.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Nov 26, 2008 12:19 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3095
Location: Cologne, Germany
If this issue still occurs with PDFsharp 1.20 published June 24, 2008 then please provide us a PDF file that allows us to replicate the issue.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Nov 26, 2008 1:45 pm 
Offline
User avatar

Joined: Tue Oct 14, 2008 6:15 pm
Posts: 32
Location: USA
Gladly. 140.pdf


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Nov 27, 2008 8:18 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3095
Location: Cologne, Germany
Hi!
Soldier-B wrote:
Gladly. 140.pdf

I tested that file with PdfSharp.Explorer and with the TwoPagesOnOne sample - no endless loop.
I cannot replicate this problem with PDFsharp 1.20 published June 24, 2008.

When does this endless loop occur?

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Dec 01, 2008 5:44 pm 
Offline
User avatar

Joined: Tue Oct 14, 2008 6:15 pm
Posts: 32
Location: USA
When using the ContentReader.ReadContent function, 100% of the time I end up stuck in the ScanHexadecimalString function with the current character always being "<" and the position never advances.

Here's some sample VB code to show you how I get stuck in the loop.

Code:
Sub Main()
    Dim doc As PdfDocument = PdfReader.Open("140.pdf")

    For Each page As PdfPage In doc.Pages
        Dim cseq As CSequence = ContentReader.ReadContent(page)
        Console.WriteLine("This message will not show.")
    Next

    doc.Close()
End Sub


I realize that this code doesn't really accomplish anything, but if you run it you will never get it to output to the console because its stuck in ScanHexadecimalString.

I hope that helps out some and thanks again.

- B


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Dec 17, 2008 3:50 pm 
Offline
User avatar

Joined: Tue Oct 14, 2008 6:15 pm
Posts: 32
Location: USA
Hi Thomas, I was curious to know if you were able to reproduce the infinite loop I get based on the code I posted?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Jan 07, 2009 9:40 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3095
Location: Cologne, Germany
Yes, I was able to replicate the problem ...
... but because parsing PDF is not my area of expertise I had to forward it to a team member.

I'm back from holiday today. I'll check if the problem was solved.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Jan 12, 2009 2:06 pm 
Offline
User avatar

Joined: Tue Oct 14, 2008 6:15 pm
Posts: 32
Location: USA
Thanks Thomas.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Apr 09, 2009 1:42 pm 
Offline
User avatar

Joined: Tue Oct 14, 2008 6:15 pm
Posts: 32
Location: USA
I'm just curious if any progress has been made towards fixing this bug.


Top
 Profile  
Reply with quote  
PostPosted: Mon Jan 11, 2016 8:24 pm 
Offline

Joined: Mon Jan 11, 2016 8:08 pm
Posts: 2
Sorry to bring this topic back to life, but I just stumbled in what seems to be the same problem.

I get an infinite loop in ScanHexadecimalString() using the latest version of PDFSharp (v1.32.2608.0) in combination with ContentReader.ReadContent().

I can reproduce the issue with this file for example.

Code:
  var document = PdfSharp.Pdf.IO.PdfReader.Open(inFileName);
  var page = document.Pages[0];
  CObject content = ContentReader.ReadContent(page); // <-- endless loop here


Is there a known fix for this, or maybe I'm doing something wrong?!

Any help would be greatly appreciated. Thanks.

PS: With the posted pdf, the lexer seems to get stucked while parsing '<' followed by '/' in an Artifact token (not sure this info would be of help, but can't hurt, right?!)


Top
 Profile  
Reply with quote  
PostPosted: Tue Jan 12, 2016 8:11 am 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 909
Location: CCAA
azrafe7 wrote:
I get an infinite loop in ScanHexadecimalString() using the latest version of PDFSharp (v1.32.2608.0) in combination with ContentReader.ReadContent().
The latest version is PDFsharp 1.50 beta 3.
If the latest version 1.50 cannot read the file then the issue will be investigated.

_________________
Best regards
Thomas
(Freelance Software Developer with several years of MigraDoc/PDFsharp experience)


Top
 Profile  
Reply with quote  
PostPosted: Tue Jan 12, 2016 12:29 pm 
Offline

Joined: Mon Jan 11, 2016 8:08 pm
Posts: 2
Sorry, my bad (I'd previously installed it via nuget).

I've retested with 1.50 from github and it works, thanks!


Top
 Profile  
Reply with quote  
PostPosted: Wed Jan 13, 2016 8:49 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3095
Location: Cologne, Germany
azrafe7 wrote:
Sorry, my bad (I'd previously installed it via nuget).
You can get 1.50 also from NuGet (include Pre-Releases in filter).

_________________
Regards
Thomas Hoevel
PDFsharp Team


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

All times are UTC


Who is online

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