diff --git a/fix-cve-2024-6239.patch b/fix-cve-2024-6239.patch new file mode 100644 index 0000000000000000000000000000000000000000..aebd15b8c06c53526bc4b36fc779e79dfe6bd225 --- /dev/null +++ b/fix-cve-2024-6239.patch @@ -0,0 +1,101 @@ +From 5d83ce7a6540ef424c2e2e8bd8947361c69eef3e Mon Sep 17 00:00:00 2001 +From: Yang_X_Y +Date: Fri, 2 Aug 2024 16:21:29 +0800 +Subject: [PATCH] fix-cve-2024-6239 + +--- + utils/pdfinfo.cc | 33 ++++++++++++++------------------- + 1 file changed, 14 insertions(+), 19 deletions(-) + +diff --git a/utils/pdfinfo.cc b/utils/pdfinfo.cc +index 1f4ca79..320600a 100644 +--- a/utils/pdfinfo.cc ++++ b/utils/pdfinfo.cc +@@ -112,11 +112,11 @@ static const ArgDesc argDesc[] = { { "-f", argInt, &firstPage, 0, "first page to + { "-?", argFlag, &printHelp, 0, "print usage information" }, + {} }; + +-static void printTextString(const GooString *s, const UnicodeMap *uMap) ++static void printStdTextString(const std::string &s, const UnicodeMap *uMap) + { + Unicode *u; + char buf[8]; +- int len = TextStringToUCS4(s->toStr(), &u); ++ int len = TextStringToUCS4(s, &u); + for (int i = 0; i < len; i++) { + int n = uMap->mapUnicode(u[i], buf, sizeof(buf)); + fwrite(buf, 1, n, stdout); +@@ -124,6 +124,11 @@ static void printTextString(const GooString *s, const UnicodeMap *uMap) + gfree(u); + } + ++static void printTextString(const GooString *s, const UnicodeMap *uMap) ++{ ++ printStdTextString(s->toStr(), uMap); ++} ++ + static void printUCS4String(const Unicode *u, int len, const UnicodeMap *uMap) + { + char buf[8]; +@@ -295,11 +300,6 @@ static void printStruct(const StructElement *element, unsigned indent) + } + } + +-struct GooStringCompare +-{ +- bool operator()(GooString *lhs, GooString *rhs) const { return lhs->cmp(const_cast(rhs)) < 0; } +-}; +- + static void printLinkDest(const std::unique_ptr &dest) + { + GooString s; +@@ -370,29 +370,25 @@ static void printLinkDest(const std::unique_ptr &dest) + + static void printDestinations(PDFDoc *doc, const UnicodeMap *uMap) + { +- std::map, GooStringCompare>> map; ++ std::map>> map; + + int numDests = doc->getCatalog()->numDestNameTree(); + for (int i = 0; i < numDests; i++) { +- GooString *name = new GooString(doc->getCatalog()->getDestNameTreeName(i)); ++ const GooString *name = doc->getCatalog()->getDestNameTreeName(i); + std::unique_ptr dest = doc->getCatalog()->getDestNameTreeDest(i); +- if (dest && dest->isPageRef()) { ++ if (name && dest && dest->isPageRef()) { + Ref pageRef = dest->getPageRef(); +- map[pageRef].insert(std::make_pair(name, std::move(dest))); +- } else { +- delete name; ++ map[pageRef].insert(std::make_pair(name->toStr(), std::move(dest))); + } + } + + numDests = doc->getCatalog()->numDests(); + for (int i = 0; i < numDests; i++) { +- GooString *name = new GooString(doc->getCatalog()->getDestsName(i)); ++ const char *name = doc->getCatalog()->getDestsName(i); + std::unique_ptr dest = doc->getCatalog()->getDestsDest(i); +- if (dest && dest->isPageRef()) { ++ if (name && dest && dest->isPageRef()) { + Ref pageRef = dest->getPageRef(); + map[pageRef].insert(std::make_pair(name, std::move(dest))); +- } else { +- delete name; + } + } + +@@ -406,9 +402,8 @@ static void printDestinations(PDFDoc *doc, const UnicodeMap *uMap) + printf("%4d ", i); + printLinkDest(it.second); + printf(" \""); +- printTextString(it.first, uMap); ++ printStdTextString(it.first, uMap); + printf("\"\n"); +- delete it.first; + } + } + } +-- +2.33.0 + diff --git a/poppler.spec b/poppler.spec index 5fb8e8ebe080589544644ccaa7c3c2d5c5bc7401..5c7ffbb8f7870d09cec4f1e197fc086aa96cfc6b 100644 --- a/poppler.spec +++ b/poppler.spec @@ -1,4 +1,4 @@ -%define anolis_release 2 +%define anolis_release 3 # %%global qt6 1 Summary: PDF rendering library @@ -15,6 +15,9 @@ Patch1: poppler-0.90.0-position-independent-code.patch Patch2: poppler-21.01.0-glib-introspection.patch Patch3: poppler-CVE-2023-34872.patch +#https://gitlab.freedesktop.org/poppler/poppler/-/commit/0554731052d1a97745cb179ab0d45620589dd9c4 +Patch4: fix-cve-2024-6239.patch + BuildRequires: cmake BuildRequires: gcc-c++ BuildRequires: gettext-devel @@ -238,6 +241,9 @@ other formats. %{_mandir}/man1/* %changelog +* Thu Aug 1 2024 yangxinyu - 23.05.0-3 +- Fix CVE-2024-6239 + * Tue Oct 17 2023 Funda Wang - 23.05.0-2 - Fix CVE-2023-34872