Fix reading of PDF files from Crystal Reports (Issue #45)

This commit is contained in:
Michael R Sweet 2023-10-09 10:04:20 -04:00
parent ed88322496
commit b0a66eef78
No known key found for this signature in database
GPG Key ID: BE67C75EC81F3244
2 changed files with 4 additions and 3 deletions

View File

@ -9,6 +9,7 @@ v1.1.2 (TBD)
dash pattern (Issue #41) dash pattern (Issue #41)
- Fixed an issue with broken PDF files containing extra CR and/or LF separators - Fixed an issue with broken PDF files containing extra CR and/or LF separators
after the object stream token (Issue #40) after the object stream token (Issue #40)
- Fixed an issue with PDF files produced by Crystal Reports (Issue #45)
- Fixed an issue with PDF files produced by Microsoft Reporting Services - Fixed an issue with PDF files produced by Microsoft Reporting Services
(Issue #46) (Issue #46)

View File

@ -1914,12 +1914,12 @@ load_xref(
} }
} }
} }
else if (!strcmp(line, "xref")) else if (!strncmp(line, "xref", 4) && !line[4] || isspace(line[4] & 255))
{ {
// Read the xref tables // Read the xref tables
while (_pdfioFileGets(pdf, line, sizeof(line))) while (_pdfioFileGets(pdf, line, sizeof(line)))
{ {
if (!strcmp(line, "trailer")) if (!strncmp(line, "trailer", 7) && !line[7] || isspace(line[7] & 255))
break; break;
else if (!line[0]) else if (!line[0])
continue; continue;
@ -1984,7 +1984,7 @@ load_xref(
} }
} }
if (strcmp(line, "trailer")) if (strncmp(line, "trailer", 7))
{ {
_pdfioFileError(pdf, "Missing trailer."); _pdfioFileError(pdf, "Missing trailer.");
return (false); return (false);