Skip to content

Commit

Permalink
IsValidXref() no will no longer check if it's inside of a stream beyo…
Browse files Browse the repository at this point in the history
…ng an EOF symbol.
  • Loading branch information
mlaukala committed Nov 14, 2017
1 parent 0e54078 commit 4cb436e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/PdfSharp/Pdf.IO/Parser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1107,14 +1107,17 @@ private bool IsValidXref()
content += _lexer.ReadRawString(content_pos, read_length);

int ss = content.IndexOf("stream", StringComparison.Ordinal);
int eof = content.IndexOf("%%EOF", StringComparison.Ordinal);
int es = content.IndexOf("endstream", StringComparison.Ordinal);

if (ss < es)
int s = Math.Min(ss, eof);

if (s < es)
{
// Not inside of stream
break;
}
else if (ss > es)
else if (s > es)
{
// inside of stream
return false;
Expand Down

0 comments on commit 4cb436e

Please sign in to comment.