From b0a66eef78472fa1342b6eeaf19a521471313e06 Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Mon, 9 Oct 2023 10:04:20 -0400 Subject: [PATCH] Fix reading of PDF files from Crystal Reports (Issue #45) --- CHANGES.md | 1 + pdfio-file.c | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index e7a6c13..5c7039c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -9,6 +9,7 @@ v1.1.2 (TBD) dash pattern (Issue #41) - Fixed an issue with broken PDF files containing extra CR and/or LF separators 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 (Issue #46) diff --git a/pdfio-file.c b/pdfio-file.c index c7c736f..55d9710 100644 --- a/pdfio-file.c +++ b/pdfio-file.c @@ -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 while (_pdfioFileGets(pdf, line, sizeof(line))) { - if (!strcmp(line, "trailer")) + if (!strncmp(line, "trailer", 7) && !line[7] || isspace(line[7] & 255)) break; else if (!line[0]) continue; @@ -1984,7 +1984,7 @@ load_xref( } } - if (strcmp(line, "trailer")) + if (strncmp(line, "trailer", 7)) { _pdfioFileError(pdf, "Missing trailer."); return (false);