From 70d69e227847099de91a1d47e12e4dfc4a9dbb87 Mon Sep 17 00:00:00 2001 From: yaphets-z <2017301500005@whu.edu.cn> Date: Thu, 30 Nov 2023 19:33:32 +0800 Subject: [PATCH] Repair CVE-2022-37051 --- utils/pdfunite.cc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/utils/pdfunite.cc b/utils/pdfunite.cc index a8116e3..3f3942d 100644 --- a/utils/pdfunite.cc +++ b/utils/pdfunite.cc @@ -210,6 +210,14 @@ int main (int argc, char *argv[]) Object ocObj; if (docs.size() >= 1) { Object catObj = docs[0]->getXRef()->getCatalog(); + if(!catObj.isDict()){ + fclose(f); + delete yRef; + delete countRef; + delete outStr; + error(errSyntaxError, -1, "XRef's Catalog is not a dictionary."); + return -1; + } Dict *catDict = catObj.getDict(); intents = catDict->lookup("OutputIntents"); afObj = catDict->lookupNF("AcroForm").copy(); @@ -310,6 +318,14 @@ int main (int argc, char *argv[]) } } Object pageCatObj = docs[i]->getXRef()->getCatalog(); + if(!pageCatObj.isDict()){ + fclose(f); + delete yRef; + delete countRef; + delete outStr; + error(errSyntaxError, -1, "XRef's Catalog is not a dictionary."); + return -1; + } Dict *pageCatDict = pageCatObj.getDict(); Object pageNames = pageCatDict->lookup("Names"); if (!pageNames.isNull() && pageNames.isDict()) { -- Gitee