Skip to content

Commit afee7e1

Browse files
committed
Added fix for 0 position xref entries not being marked as free.
1 parent 56e5640 commit afee7e1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/PdfSharp/Pdf.IO/Parser.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1382,6 +1382,14 @@ private PdfTrailer ReadXRefTableAndTrailer(PdfCrossReferenceTable xrefTable, int
13821382
// Skip unused entries.
13831383
if (token != "n")
13841384
continue;
1385+
1386+
// Mac OS X 10.12.6 Quartz PDFContext fails to mark 0 position entries as free.
1387+
// According to spec, we could skip anything less than 8 (e.g. '%PDF-1.n' where n is a digit between 0 and 7 must be the header of a file)
1388+
// but anything between 0 and 8 (1-7) could be the indication of a much larger problem.
1389+
// https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/PDF32000_2008.pdf 7.5.2
1390+
// Skip 0 position entries.
1391+
if (position == 0)
1392+
continue;
13851393
#if true
13861394
//!!!new 2018-03-14 begin
13871395
// Check if the object at the address has the correct ID and generation.

0 commit comments

Comments
 (0)