Skip to content

Conversation

@iquirino
Copy link

_lexer.Position = -1 cause System.IO.MemoryStream.set_Position to be -1.
https://imgur.com/a/hy8TKdu

_lexer.Position = -1 cause System.IO.MemoryStream.set_Position to be -1.
https://imgur.com/a/hy8TKdu
@mitchcapper
Copy link

It should be noted that PR only handles one condition in which this exception can occur, does not fix all non-negative number errors

@iquirino
Copy link
Author

I work with thousands pdf in a day.
This one is the only non negative exception tha i have catched.

I think it can be merged...
And then you can solve other point...
?

@iquirino
Copy link
Author

Is clear to me that idx validation need to be inside of startxref var instantiation

@mitchcapper
Copy link

Sorry @iquirino didn't mean to be rude, I actually am tracking down a dictionary read error on opening a PDF from an online system. It also generates this error and between this pr AND #95 I was hoping one of them addressed i (as pdfs open fine in acrobat). Sadly not.

My warning was just to others that this may not resolve all the stream seek isues.

 	PdfSharp-wpf.dll!PdfSharp.Pdf.IO.Lexer.Position.set(int value) Line 71	C#
 	PdfSharp-wpf.dll!PdfSharp.Pdf.IO.Parser.MoveToObject(PdfSharp.Pdf.PdfObjectID objectID) Line 80	C#
>	PdfSharp-wpf.dll!PdfSharp.Pdf.IO.Parser.ReadObject(PdfSharp.Pdf.PdfObject pdfObject, PdfSharp.Pdf.PdfObjectID objectID, bool includeReferences, bool fromObjecStream) Line 121	C#
 	PdfSharp-wpf.dll!PdfSharp.Pdf.IO.Parser.GetStreamLength(PdfSharp.Pdf.PdfDictionary dict) Line 317	C#
 	PdfSharp-wpf.dll!PdfSharp.Pdf.IO.Parser.ReadStream(PdfSharp.Pdf.PdfDictionary dict) Line 287	C#
 	PdfSharp-wpf.dll!PdfSharp.Pdf.IO.Parser.ReadObject(PdfSharp.Pdf.PdfObject pdfObject, PdfSharp.Pdf.PdfObjectID objectID, bool includeReferences, bool fromObjecStream) Line 269	C#
 	PdfSharp-wpf.dll!PdfSharp.Pdf.IO.PdfReader.Open(System.IO.Stream stream, string password, PdfSharp.Pdf.IO.PdfDocumentOpenMode openmode, PdfSharp.Pdf.IO.PdfPasswordProvider passwordProvider) Line 433	C#
 	PdfSharp-wpf.dll!PdfSharp.Pdf.IO.PdfReader.Open(string path, string password, PdfSharp.Pdf.IO.PdfDocumentOpenMode openmode, PdfSharp.Pdf.IO.PdfPasswordProvider provider) Line 216	C#
 	PdfSharp-wpf.dll!PdfSharp.Pdf.IO.PdfReader.Open(string path, PdfSharp.Pdf.IO.PdfDocumentOpenMode openmode) Line 186	C#
 	testParse.dll!testParse.MainWindow.MainWindow_Loaded(object sender, System.Windows.RoutedEventArgs e) Line 51	C#

@iquirino
Copy link
Author

PR #95 will solve this issue too or you need to replicate this in PR #95?

@mitchcapper
Copy link

#95 actually did not, it seems its an issue when reading the dictionary during opening so while #95 solves some it didn't solve this. I am digging into it more but the .net core port seems more maintained so will probably submit more PR over there.

@ThomasHoevel
Copy link
Member

Fixed in current internal builds of PDFsharp.

@iquirino
Copy link
Author

Thank you! ;)

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

Successfully merging this pull request may close these issues.

3 participants