99acecd860
Resolves: #1665274
28 lines
1.2 KiB
Diff
28 lines
1.2 KiB
Diff
diff --git a/utils/pdfunite.cc b/utils/pdfunite.cc
|
|
index 61613f60..462fb00c 100644
|
|
--- a/utils/pdfunite.cc
|
|
+++ b/utils/pdfunite.cc
|
|
@@ -165,7 +165,7 @@ int main (int argc, char *argv[])
|
|
for (i = 1; i < argc - 1; i++) {
|
|
GooString *gfileName = new GooString(argv[i]);
|
|
PDFDoc *doc = new PDFDoc(gfileName, nullptr, nullptr, nullptr);
|
|
- if (doc->isOk() && !doc->isEncrypted()) {
|
|
+ if (doc->isOk() && !doc->isEncrypted() && doc->getXRef()->getCatalog().isDict()) {
|
|
docs.push_back(doc);
|
|
if (doc->getPDFMajorVersion() > majorVersion) {
|
|
majorVersion = doc->getPDFMajorVersion();
|
|
@@ -175,9 +175,12 @@ int main (int argc, char *argv[])
|
|
minorVersion = doc->getPDFMinorVersion();
|
|
}
|
|
}
|
|
- } else if (doc->isOk()) {
|
|
+ } else if (doc->isEncrypted()) {
|
|
error(errUnimplemented, -1, "Could not merge encrypted files ('{0:s}')", argv[i]);
|
|
return -1;
|
|
+ } else if (!doc->getXRef()->getCatalog().isDict()) {
|
|
+ error(errSyntaxError, -1, "Catalog is not a dictionary ('{0:s}')", argv[i]);
|
|
+ return -1;
|
|
} else {
|
|
error(errSyntaxError, -1, "Could not merge damaged documents ('{0:s}')", argv[i]);
|
|
return -1;
|