Skip to content

Commit 4fa3ff3

Browse files
committed
IsValidXref() no will no longer check if it's inside of a stream beyong an EOF symbol.
1 parent 15ac2bb commit 4fa3ff3

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/PdfSharp/Pdf.IO/Parser.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,14 +1088,17 @@ private bool IsValidXref()
10881088
content += _lexer.ReadRawString(content_pos, read_length);
10891089

10901090
int ss = content.IndexOf("stream", StringComparison.Ordinal);
1091+
int eof = content.IndexOf("%%EOF", StringComparison.Ordinal);
10911092
int es = content.IndexOf("endstream", StringComparison.Ordinal);
10921093

1093-
if (ss < es)
1094+
int s = Math.Min(ss, eof);
1095+
1096+
if (s < es)
10941097
{
10951098
// Not inside of stream
10961099
break;
10971100
}
1098-
else if (es != -1 && ss > es)
1101+
else if (s > es)
10991102
{
11001103
// inside of stream
11011104
return false;

0 commit comments

Comments
 (0)