Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Step:FrontRunner
poppler
poppler-CVE-2024-6239.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File poppler-CVE-2024-6239.patch of Package poppler
From 0554731052d1a97745cb179ab0d45620589dd9c4 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid <aacid@kde.org> Date: Fri, 7 Jun 2024 00:54:55 +0200 Subject: [PATCH] pdfinfo: Fix crash in broken documents when using -dests --- utils/pdfinfo.cc | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) Index: poppler-22.01.0/utils/pdfinfo.cc =================================================================== --- poppler-22.01.0.orig/utils/pdfinfo.cc +++ poppler-22.01.0/utils/pdfinfo.cc @@ -112,11 +112,11 @@ static const ArgDesc argDesc[] = { { "-f { "-?", 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 GooStr 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]; @@ -293,11 +298,6 @@ static void printStruct(const StructElem } } -struct GooStringCompare -{ - bool operator()(GooString *lhs, GooString *rhs) const { return lhs->cmp(const_cast<GooString *>(rhs)) < 0; } -}; - static void printLinkDest(const std::unique_ptr<LinkDest> &dest) { GooString s; @@ -368,29 +368,25 @@ static void printLinkDest(const std::uni static void printDestinations(PDFDoc *doc, const UnicodeMap *uMap) { - std::map<Ref, std::map<GooString *, std::unique_ptr<LinkDest>, GooStringCompare>> map; + std::map<Ref, std::map<std::string, std::unique_ptr<LinkDest>>> 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<LinkDest> 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<LinkDest> 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; } } @@ -404,9 +400,8 @@ static void printDestinations(PDFDoc *do printf("%4d ", i); printLinkDest(it.second); printf(" \""); - printTextString(it.first, uMap); + printStdTextString(it.first, uMap); printf("\"\n"); - delete it.first; } } }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor