Update to 0.73.0

This commit is contained in:
Marek Kasik 2019-01-25 20:05:03 +01:00
parent f513561f6c
commit 568ecdfabe
16 changed files with 342 additions and 1075 deletions

2
.gitignore vendored
View File

@ -3,3 +3,5 @@
/poppler-0.62.0.tar.xz
/poppler-0.63.0.tar.xz
/poppler-0.67.0.tar.xz
/poppler-0.73.0.tar.xz
/poppler-test-2018-12-18-45f55f1e03b9bf3fbd334c31776b6f5e472889ec.tar.xz

File diff suppressed because it is too large Load Diff

View File

@ -24,11 +24,11 @@ index 7c2ca78..e93908c 100644
+// a and b don't need to be sorted.
+#define XBetweenAB(x,a,b) (!(((x) > (a) && (x) > (b)) || \
+ ((x) < (a) && (x) < (b))) ? \
+ gTrue : gFalse)
+ true : false)
+
static int reorderText(Unicode *text, int len, UnicodeMap *uMap, GBool primaryLR, GooString *s, Unicode* u) {
char lre[8], rle[8], popdf[8], buf[8];
int lreLen = 0, rleLen = 0, popdfLen = 0, n;
namespace {
inline bool isAscii7 (Unicode uchar) {
@@ -4411,11 +4417,37 @@ void TextSelectionSizer::visitLine (TextLine *line,
PDFRectangle *rect;
double x1, y1, x2, y2, margin;

View File

@ -19,7 +19,7 @@ index 631ab27b..b2e730bf 100644
+++ b/poppler/CairoOutputDev.cc
@@ -915,6 +915,8 @@ GBool CairoOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *cat
StrokePathClip *strokePathTmp;
GBool adjusted_stroke_width_tmp;
bool adjusted_stroke_width_tmp;
cairo_pattern_t *maskTmp;
+ double xoffset, yoffset;
+ double det;
@ -28,11 +28,11 @@ index 631ab27b..b2e730bf 100644
height = bbox[3] - bbox[1];
@@ -976,6 +978,15 @@ GBool CairoOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *cat
if (cairo_pattern_status (pattern))
return gFalse;
return false;
+ det = pmat[0] * pmat[3] - pmat[1] * pmat[2];
+ if (fabs(det) < 0.000001)
+ return gFalse;
+ return false;
+
+ xoffset = round ((pmat[3] * pmat[4] - pmat[2] * pmat[5]) / (xStep * det));
+ yoffset = - round ((pmat[1] * pmat[4] - pmat[0] * pmat[5]) / (yStep * det));

View File

@ -1,65 +0,0 @@
From 3d35d209c19c1d3b09b794a0c863ba5de44a9c0a Mon Sep 17 00:00:00 2001
From: Marek Kasik <mkasik@redhat.com>
Date: Mon, 29 Oct 2018 17:44:47 +0100
Subject: [PATCH] Avoid cycles in PDF parsing
Mark objects being processed in Parser::makeStream() as being processed
and check the mark when entering this method to avoid processing
of the same object recursively.
---
poppler/Parser.cc | 15 +++++++++++++++
poppler/XRef.h | 1 +
2 files changed, 16 insertions(+)
diff --git a/poppler/Parser.cc b/poppler/Parser.cc
index bd4845ab..8f48efbe 100644
--- a/poppler/Parser.cc
+++ b/poppler/Parser.cc
@@ -197,6 +197,18 @@ Stream *Parser::makeStream(Object &&dict, Guchar *fileKey,
Stream *str;
Goffset length;
Goffset pos, endPos;
+ XRefEntry *entry = nullptr;
+
+ if (xref && (entry = xref->getEntry(objNum, false))) {
+ if (!entry->getFlag(XRefEntry::Parsing) ||
+ (objNum == 0 && objGen == 0)) {
+ entry->setFlag(XRefEntry::Parsing, true);
+ } else {
+ error(errSyntaxError, getPos(),
+ "Object '{0:d} {1:d} obj' is being already parsed", objNum, objGen);
+ return nullptr;
+ }
+ }
// get stream start position
lexer->skipToNextLine();
@@ -278,6 +290,9 @@ Stream *Parser::makeStream(Object &&dict, Guchar *fileKey,
// get filters
str = str->addFilters(str->getDict(), recursion);
+ if (entry)
+ entry->setFlag(XRefEntry::Parsing, false);
+
return str;
}
diff --git a/poppler/XRef.h b/poppler/XRef.h
index 11ee5e03..2eb2f9fd 100644
--- a/poppler/XRef.h
+++ b/poppler/XRef.h
@@ -68,7 +68,10 @@ struct XRefEntry {
// Special flags -- available only after xref->scanSpecialFlags() is run
Unencrypted, // Entry is stored in unencrypted form (meaningless in unencrypted documents)
- DontRewrite // Entry must not be written back in case of full rewrite
+ DontRewrite, // Entry must not be written back in case of full rewrite
+
+ // Regular flag (moved here to preserve values of previous flags)
+ Parsing // Entry is currently being parsed
};
inline GBool getFlag(Flag flag) const {
--
2.19.1

View File

@ -1,63 +0,0 @@
From e07c8b4784234383cb5ddcf1133ea91a772506e2 Mon Sep 17 00:00:00 2001
From: Adam Reichold <adam.reichold@t-online.de>
Date: Tue, 1 Jan 2019 10:54:40 +0100
Subject: [PATCH] Avoid global display profile state becoming an uncontrolled
memory leak by enforcing single initialization. Closes #654
---
poppler/GfxState.cc | 9 +++++++++
qt5/src/poppler-qt5.h | 4 ++++
2 files changed, 13 insertions(+)
diff --git a/poppler/GfxState.cc b/poppler/GfxState.cc
index 87b7ce03..4e3ccbfd 100644
--- a/poppler/GfxState.cc
+++ b/poppler/GfxState.cc
@@ -226,6 +226,10 @@ static unsigned int getCMSNChannels(cmsColorSpaceSignature cs);
static cmsHPROFILE loadColorProfile(const char *fileName);
void GfxColorSpace::setDisplayProfile(void *displayProfileA) {
+ if (displayProfile != nullptr) {
+ error(errInternal, -1, "The display color profile can only be set once before any rendering is done.");
+ return;
+ }
displayProfile = displayProfileA;
if (displayProfile != nullptr) {
cmsHTRANSFORM transform;
@@ -249,6 +253,11 @@ void GfxColorSpace::setDisplayProfile(void *displayProfileA) {
}
void GfxColorSpace::setDisplayProfileName(GooString *name) {
+ if (displayProfile != nullptr) {
+ error(errInternal, -1, "The display color profile can only be set before any rendering is done.");
+ return;
+ }
+ delete displayProfileName;
displayProfileName = name->copy();
}
diff --git a/qt5/src/poppler-qt5.h b/qt5/src/poppler-qt5.h
index 4f06c47e..ddac7dfb 100644
--- a/qt5/src/poppler-qt5.h
+++ b/qt5/src/poppler-qt5.h
@@ -1102,6 +1102,8 @@ delete it;
\param outputProfileA is a \c cmsHPROFILE of the LCMS library.
+ \note This should be called before any rendering happens and only once during the lifetime of the current process.
+
\since 0.12
*/
void setColorDisplayProfile(void *outputProfileA);
@@ -1110,6 +1112,8 @@ delete it;
\param name is the name of the display profile to set.
+ \note This should be called before any rendering happens.
+
\since 0.12
*/
void setColorDisplayProfileName(const QString &name);
--
2.20.1

View File

@ -1,63 +0,0 @@
From 39a251b1b3a3343400a08e2f03c5518a26624626 Mon Sep 17 00:00:00 2001
From: Adam Reichold <adam.reichold@t-online.de>
Date: Mon, 24 Dec 2018 15:40:38 +0100
Subject: [PATCH] Do not try to parse into unallocated XRef entry and return
pointer to dummy entry instead. Closes #692 and oss-fuzz/12330
---
poppler/XRef.cc | 27 +++++++++++++++++++++------
1 file changed, 21 insertions(+), 6 deletions(-)
diff --git a/poppler/XRef.cc b/poppler/XRef.cc
index 0ec66944..d042d1f4 100644
--- a/poppler/XRef.cc
+++ b/poppler/XRef.cc
@@ -1548,11 +1548,31 @@ void XRef::readXRefUntil(int untilEntryNum, std::vector<int> *xrefStreamObjsNum)
}
}
+namespace {
+
+struct DummyXRefEntry : XRefEntry {
+ DummyXRefEntry() {
+ offset = 0;
+ gen = -1;
+ type = xrefEntryNone;
+ flags = 0;
+ }
+};
+
+DummyXRefEntry dummyXRefEntry;
+
+}
+
XRefEntry *XRef::getEntry(int i, GBool complainIfMissing)
{
if (i >= size || entries[i].type == xrefEntryNone) {
if ((!xRefStream) && mainXRefEntriesOffset) {
+ if (unlikely(i >= capacity)) {
+ error(errInternal, -1, "Request for out-of-bounds XRef entry [{0:d}]", i);
+ return &dummyXRefEntry;
+ }
+
if (!parseEntry(mainXRefEntriesOffset + 20*i, &entries[i])) {
error(errSyntaxError, -1, "Failed to parse XRef entry [{0:d}].", i);
}
@@ -1563,12 +1583,7 @@ XRefEntry *XRef::getEntry(int i, bool complainIfMissing)
// We might have reconstructed the xref
// Check again i is in bounds
if (unlikely(i >= size)) {
- static XRefEntry dummy;
- dummy.offset = 0;
- dummy.gen = -1;
- dummy.type = xrefEntryNone;
- dummy.flags = 0;
- return &dummy;
+ return &dummyXRefEntry;
}
if (entries[i].type == xrefEntryNone) {
--
2.20.1

View File

@ -1,71 +0,0 @@
From 614514f577bbe676f736afcd8065892df8391315 Mon Sep 17 00:00:00 2001
From: Marek Kasik <mkasik@redhat.com>
Date: Fri, 20 Apr 2018 11:38:13 +0200
Subject: [PATCH] Fix crash on missing embedded file
Check whether an embedded file is actually present in the PDF
and show warning in that case.
https://bugs.freedesktop.org/show_bug.cgi?id=106137
https://gitlab.freedesktop.org/poppler/poppler/issues/236
---
glib/poppler-attachment.cc | 26 +++++++++++++++++---------
glib/poppler-document.cc | 3 ++-
2 files changed, 19 insertions(+), 10 deletions(-)
diff --git a/glib/poppler-attachment.cc b/glib/poppler-attachment.cc
index c6502e9d..11ba5bb5 100644
--- a/glib/poppler-attachment.cc
+++ b/glib/poppler-attachment.cc
@@ -111,17 +111,25 @@ _poppler_attachment_new (FileSpec *emb_file)
attachment->description = _poppler_goo_string_to_utf8 (emb_file->getDescription ());
embFile = emb_file->getEmbeddedFile();
- attachment->size = embFile->size ();
+ if (embFile != NULL && embFile->streamObject()->isStream())
+ {
+ attachment->size = embFile->size ();
- if (embFile->createDate ())
- _poppler_convert_pdf_date_to_gtime (embFile->createDate (), (time_t *)&attachment->ctime);
- if (embFile->modDate ())
- _poppler_convert_pdf_date_to_gtime (embFile->modDate (), (time_t *)&attachment->mtime);
+ if (embFile->createDate ())
+ _poppler_convert_pdf_date_to_gtime (embFile->createDate (), (time_t *)&attachment->ctime);
+ if (embFile->modDate ())
+ _poppler_convert_pdf_date_to_gtime (embFile->modDate (), (time_t *)&attachment->mtime);
- if (embFile->checksum () && embFile->checksum ()->getLength () > 0)
- attachment->checksum = g_string_new_len (embFile->checksum ()->getCString (),
- embFile->checksum ()->getLength ());
- priv->obj_stream = embFile->streamObject()->copy();
+ if (embFile->checksum () && embFile->checksum ()->getLength () > 0)
+ attachment->checksum = g_string_new_len (embFile->checksum ()->getCString (),
+ embFile->checksum ()->getLength ());
+ priv->obj_stream = embFile->streamObject()->copy();
+ }
+ else
+ {
+ g_warning ("Missing stream object for embedded file");
+ g_clear_object (&attachment);
+ }
return attachment;
}
diff --git a/glib/poppler-document.cc b/glib/poppler-document.cc
index b343eb90..df0aa47f 100644
--- a/glib/poppler-document.cc
+++ b/glib/poppler-document.cc
@@ -666,7 +666,8 @@ poppler_document_get_attachments (PopplerDocument *document)
attachment = _poppler_attachment_new (emb_file);
delete emb_file;
- retval = g_list_prepend (retval, attachment);
+ if (attachment != NULL)
+ retval = g_list_prepend (retval, attachment);
}
return g_list_reverse (retval);
}
--
2.17.0

View File

@ -1,35 +0,0 @@
From de0c0b8324e776f0b851485e0fc9622fc35695b7 Mon Sep 17 00:00:00 2001
From: Albert Astals Cid <aacid@kde.org>
Date: Sat, 29 Dec 2018 01:25:17 +0100
Subject: [PATCH] FileSpec: Move the fileSpec.dictLookup call inside
fileSpec.isDict if
Fixes #704
---
poppler/FileSpec.cc | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/poppler/FileSpec.cc b/poppler/FileSpec.cc
index 8a8b9e7e..7c12da63 100644
--- a/poppler/FileSpec.cc
+++ b/poppler/FileSpec.cc
@@ -133,11 +133,12 @@ FileSpec::FileSpec(const Object *fileSpecA)
return;
}
}
- }
- obj1 = fileSpec.dictLookup("Desc");
- if (obj1.isString())
- desc = obj1.getString()->copy();
+ obj1 = fileSpec.dictLookup("Desc");
+ if (obj1.isString()) {
+ desc = obj1.getString()->copy();
+ }
+ }
}
FileSpec::~FileSpec()
--
2.20.1

View File

@ -1,34 +1,3 @@
--- poppler-0.67.0/qt4/src/ArthurOutputDev.cc.orig 2018-08-08 10:13:17.127028046 +0200
+++ poppler-0.67.0/qt4/src/ArthurOutputDev.cc 2018-08-08 11:13:37.377483041 +0200
@@ -68,7 +68,7 @@
class SplashOutFontFileID: public SplashFontFileID {
public:
- SplashOutFontFileID(Ref *rA) { r = *rA; }
+ SplashOutFontFileID(const Ref *rA) { r = *rA; }
~SplashOutFontFileID() {}
--- poppler-0.67.0/qt4/src/poppler-annotation.cc.orig 2018-08-08 10:13:17.129028061 +0200
+++ poppler-0.67.0/qt4/src/poppler-annotation.cc 2018-08-08 10:44:58.038166746 +0200
@@ -534,7 +534,7 @@ QList<Annotation*> AnnotationPrivate::fi
MovieObject *movie = new MovieObject( movieann );
m->setMovie( movie );
// -> movieTitle
- GooString * movietitle = movieann->getTitle();
+ const GooString * movietitle = movieann->getTitle();
if ( movietitle )
m->setMovieTitle( QString::fromLatin1( movietitle->getCString() ) );
break;
@@ -554,7 +554,7 @@ QList<Annotation*> AnnotationPrivate::fi
s->setAction( static_cast<Poppler::LinkRendition *>(popplerLink) );
// -> screenTitle
- GooString * screentitle = screenann->getTitle();
+ const GooString * screentitle = screenann->getTitle();
if ( screentitle )
s->setScreenTitle( UnicodeParsedString( screentitle ) );
break;
--- poppler-0.67.0/qt4/src/poppler-document.cc.orig 2018-08-08 10:13:17.130028069 +0200
+++ poppler-0.67.0/qt4/src/poppler-document.cc 2018-08-08 11:14:58.301690615 +0200
@@ -605,7 +605,7 @@ namespace Poppler {
@ -86,90 +55,30 @@
{
- GooString *goo = m_embeddedFile->embFile() ? m_embeddedFile->embFile()->modDate() : NULL;
+ const GooString *goo = m_embeddedFile->embFile() ? m_embeddedFile->embFile()->modDate() : NULL;
return goo ? convertDate(goo->getCString()) : QDateTime();
return goo ? convertDate(goo->c_str()) : QDateTime();
}
QDateTime EmbeddedFile::createDate() const
{
- GooString *goo = m_embeddedFile->embFile() ? m_embeddedFile->embFile()->createDate() : NULL;
+ const GooString *goo = m_embeddedFile->embFile() ? m_embeddedFile->embFile()->createDate() : NULL;
return goo ? convertDate(goo->getCString()) : QDateTime();
return goo ? convertDate(goo->c_str()) : QDateTime();
}
QByteArray EmbeddedFile::checksum() const
{
- GooString *goo = m_embeddedFile->embFile() ? m_embeddedFile->embFile()->checksum() : NULL;
+ const GooString *goo = m_embeddedFile->embFile() ? m_embeddedFile->embFile()->checksum() : NULL;
return goo ? QByteArray::fromRawData(goo->getCString(), goo->getLength()) : QByteArray();
return goo ? QByteArray::fromRawData(goo->c_str(), goo->getLength()) : QByteArray();
}
QString EmbeddedFile::mimeType() const
{
- GooString *goo = m_embeddedFile->embFile() ? m_embeddedFile->embFile()->mimeType() : NULL;
+ const GooString *goo = m_embeddedFile->embFile() ? m_embeddedFile->embFile()->mimeType() : NULL;
return goo ? QString(goo->getCString()) : QString();
return goo ? QString(goo->c_str()) : QString();
}
--- poppler-0.67.0/qt4/src/poppler-form.cc.orig 2018-08-08 10:13:17.130028069 +0200
+++ poppler-0.67.0/qt4/src/poppler-form.cc 2018-08-08 10:51:46.240825862 +0200
@@ -104,7 +104,7 @@ int FormField::id() const
QString FormField::name() const
{
QString name;
- if (GooString *goo = m_formData->fm->getPartialName())
+ if (const GooString *goo = m_formData->fm->getPartialName())
{
name = QString::fromLatin1(goo->getCString());
}
@@ -114,7 +114,7 @@ QString FormField::name() const
QString FormField::fullyQualifiedName() const
{
QString name;
- if (GooString *goo = m_formData->fm->getFullyQualifiedName())
+ if (const GooString *goo = m_formData->fm->getFullyQualifiedName())
{
name = UnicodeParsedString(goo);
}
@@ -124,7 +124,7 @@ QString FormField::fullyQualifiedName()
QString FormField::uiName() const
{
QString name;
- if (GooString *goo = m_formData->fm->getAlternateUiName())
+ if (const GooString *goo = m_formData->fm->getAlternateUiName())
{
name = QString::fromLatin1(goo->getCString());
}
@@ -271,7 +271,7 @@ FormFieldText::TextType FormFieldText::t
QString FormFieldText::text() const
{
- GooString *goo = static_cast<FormWidgetText*>(m_formData->fm)->getContent();
+ const GooString *goo = static_cast<FormWidgetText*>(m_formData->fm)->getContent();
return UnicodeParsedString(goo);
}
--- poppler-0.67.0/qt4/src/poppler-link.cc.orig 2018-08-08 10:13:17.131028077 +0200
+++ poppler-0.67.0/qt4/src/poppler-link.cc 2018-08-08 10:59:12.395546232 +0200
@@ -232,7 +232,7 @@ class LinkMoviePrivate : public LinkPriv
: d( new LinkDestinationPrivate )
{
bool deleteDest = false;
- LinkDest *ld = data.ld;
+ const LinkDest *ld = data.ld;
if ( data.namedDest && !ld && !data.externalDest )
{
--- poppler-0.67.0/qt4/src/poppler-media.cc.orig 2018-08-08 10:13:17.131028077 +0200
+++ poppler-0.67.0/qt4/src/poppler-media.cc 2018-08-08 11:10:51.802056415 +0200
@@ -151,7 +151,7 @@ QSize
MediaRendition::size() const
{
Q_D( const MediaRendition );
- MediaParameters *mp = 0;
+ const MediaParameters *mp = 0;
if (d->rendition->getBEParameters())
mp = d->rendition->getBEParameters();
--- poppler-0.67.0/qt4/src/poppler-movie.cc.orig 2018-08-08 10:13:17.131028077 +0200
+++ poppler-0.67.0/qt4/src/poppler-movie.cc 2018-08-08 10:52:41.284914743 +0200
@@ -57,7 +57,7 @@ MovieObject::MovieObject( AnnotMovie *an
@ -187,154 +96,9 @@
{
- GooString * goo = m_movieData->m_movieObj->getFileName();
+ const GooString * goo = m_movieData->m_movieObj->getFileName();
return goo ? QString( goo->getCString() ) : QString();
return goo ? QString( goo->c_str() ) : QString();
}
--- poppler-0.67.0/qt4/src/poppler-optcontent.cc.orig 2018-08-08 10:13:17.131028077 +0200
+++ poppler-0.67.0/qt4/src/poppler-optcontent.cc 2018-08-08 10:53:34.222000220 +0200
@@ -213,7 +213,7 @@ namespace Poppler
} else if ( (orderItem.isArray()) && (orderItem.arrayGetLength() > 0) ) {
parseOrderArray(lastItem, orderItem.getArray());
} else if ( orderItem.isString() ) {
- GooString *label = orderItem.getString();
+ const GooString *label = orderItem.getString();
OptContentItem *header = new OptContentItem ( UnicodeParsedString ( label ) );
m_headerOptContentItems.append( header );
addChild( parentNode, header );
@@ -396,7 +396,7 @@ namespace Poppler
QSet<OptContentItem *> changedItems;
- GooList *statesList = popplerLinkOCGState->getStateList();
+ const GooList *statesList = popplerLinkOCGState->getStateList();
for (int i = 0; i < statesList->getLength(); ++i) {
::LinkOCGState::StateList *stateList = (::LinkOCGState::StateList*)statesList->get(i);
--- poppler-0.67.0/qt4/src/poppler-page.cc.orig 2018-08-08 10:13:17.132028085 +0200
+++ poppler-0.67.0/qt4/src/poppler-page.cc 2018-08-08 10:54:22.980078936 +0200
@@ -103,7 +103,7 @@ Link* PageData::convertLinkActionToLink(
case actionLaunch:
{
LinkLaunch * e = (LinkLaunch *)a;
- GooString * p = e->getParams();
+ const GooString * p = e->getParams();
popplerLink = new LinkExecute( linkArea, e->getFileName()->getCString(), p ? p->getCString() : 0 );
}
break;
--- poppler-0.67.0/qt4/src/poppler-private.cc.orig 2018-08-08 10:13:17.132028085 +0200
+++ poppler-0.67.0/qt4/src/poppler-private.cc 2018-08-08 11:03:25.964955666 +0200
@@ -73,7 +73,7 @@ namespace Debug {
(*Debug::debugFunction)(emsg, Debug::debugClosure);
}
- QString unicodeToQString(Unicode* u, int len) {
+ QString unicodeToQString(const Unicode* u, int len) {
if (!utf8Map)
{
GooString enc("UTF-8");
@@ -98,11 +98,11 @@ namespace Debug {
return QString::fromUtf8(convertedStr.getCString(), convertedStr.getLength());
}
- QString UnicodeParsedString(GooString *s1) {
+ QString UnicodeParsedString(const GooString *s1) {
if ( !s1 || s1->getLength() == 0 )
return QString();
- char *cString;
+ const char *cString;
int stringLength;
bool deleteCString;
if ( ( s1->getChar(0) & 0xff ) == 0xfe && ( s1->getLength() > 1 && ( s1->getChar(1) & 0xff ) == 0xff ) )
@@ -162,7 +162,7 @@ namespace Debug {
return QStringToUnicodeGooString(dt.toUTC().toString("yyyyMMddhhmmss+00'00'"));
}
- static void linkActionToTocItem( ::LinkAction * a, DocumentData * doc, QDomElement * e )
+ static void linkActionToTocItem( const ::LinkAction * a, DocumentData * doc, QDomElement * e )
{
if ( !a || !e )
return;
@@ -172,14 +172,14 @@ namespace Debug {
case actionGoTo:
{
// page number is contained/referenced in a LinkGoTo
- LinkGoTo * g = static_cast< LinkGoTo * >( a );
- LinkDest * destination = g->getDest();
+ const LinkGoTo * g = static_cast< const LinkGoTo * >( a );
+ const LinkDest * destination = g->getDest();
if ( !destination && g->getNamedDest() )
{
// no 'destination' but an internal 'named reference'. we could
// get the destination for the page now, but it's VERY time consuming,
// so better storing the reference and provide the viewport on demand
- GooString *s = g->getNamedDest();
+ const GooString *s = g->getNamedDest();
QChar *charArray = new QChar[s->getLength()];
for (int i = 0; i < s->getLength(); ++i) charArray[i] = QChar(s->getCString()[i]);
QString aux(charArray, s->getLength());
@@ -196,14 +196,14 @@ namespace Debug {
case actionGoToR:
{
// page number is contained/referenced in a LinkGoToR
- LinkGoToR * g = static_cast< LinkGoToR * >( a );
- LinkDest * destination = g->getDest();
+ const LinkGoToR * g = static_cast< const LinkGoToR * >( a );
+ const LinkDest * destination = g->getDest();
if ( !destination && g->getNamedDest() )
{
// no 'destination' but an internal 'named reference'. we could
// get the destination for the page now, but it's VERY time consuming,
// so better storing the reference and provide the viewport on demand
- GooString *s = g->getNamedDest();
+ const GooString *s = g->getNamedDest();
QChar *charArray = new QChar[s->getLength()];
for (int i = 0; i < s->getLength(); ++i) charArray[i] = QChar(s->getCString()[i]);
QString aux(charArray, s->getLength());
@@ -220,7 +220,7 @@ namespace Debug {
}
case actionURI:
{
- LinkURI * u = static_cast< LinkURI * >( a );
+ const LinkURI * u = static_cast< const LinkURI * >( a );
e->setAttribute( "DestinationURI", u->getURI()->getCString() );
}
default: ;
@@ -260,7 +260,7 @@ namespace Debug {
}
- void DocumentData::addTocChildren( QDomDocument * docSyn, QDomNode * parent, GooList * items )
+ void DocumentData::addTocChildren( QDomDocument * docSyn, QDomNode * parent, const GooList * items )
{
int numItems = items->getLength();
for ( int i = 0; i < numItems; ++i )
@@ -270,7 +270,7 @@ namespace Debug {
// 1. create element using outlineItem's title as tagName
QString name;
- Unicode * uniChar = outlineItem->getTitle();
+ const Unicode * uniChar = outlineItem->getTitle();
int titleLength = outlineItem->getTitleLength();
name = unicodeToQString(uniChar, titleLength);
if ( name.isEmpty() )
@@ -280,14 +280,14 @@ namespace Debug {
parent->appendChild( item );
// 2. find the page the link refers to
- ::LinkAction * a = outlineItem->getAction();
+ const ::LinkAction * a = outlineItem->getAction();
linkActionToTocItem( a, this, &item );
item.setAttribute( "Open", QVariant( (bool)outlineItem->isOpen() ).toString() );
// 3. recursively descend over children
outlineItem->open();
- GooList * children = outlineItem->getKids();
+ const GooList * children = outlineItem->getKids();
if ( children )
addTocChildren( docSyn, &item, children );
}
--- poppler-0.67.0/qt4/src/poppler-private.h.orig 2018-08-08 10:13:17.132028085 +0200
+++ poppler-0.67.0/qt4/src/poppler-private.h 2018-08-08 11:00:30.836672893 +0200
@@ -54,9 +54,9 @@ class FormWidget;
@ -399,6 +163,6 @@
- GooString * goo = m_soundData->m_soundObj->getFileName();
+ const GooString * goo = m_soundData->m_soundObj->getFileName();
return goo ? QString( goo->getCString() ) : QString();
return goo ? QString( goo->c_str() ) : QString();
}

View File

@ -1,51 +0,0 @@
From 7f87dc10b6adccd6d1b977a28b064add254aa2da Mon Sep 17 00:00:00 2001
From: Adam Reichold <adam.reichold@t-online.de>
Date: Thu, 27 Dec 2018 11:54:53 +0100
Subject: [PATCH] Do not try to construct invalid rich media annotation assets.
Closes #703
---
poppler/Annot.cc | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/poppler/Annot.cc b/poppler/Annot.cc
index 2e4770ab..1750dc70 100644
--- a/poppler/Annot.cc
+++ b/poppler/Annot.cc
@@ -6418,20 +6418,22 @@ AnnotRichMedia::Content::Content(Dict *dict) {
if (obj1.isDict()) {
Object obj2 = obj1.getDict()->lookup("Names");
if (obj2.isArray()) {
- nAssets = obj2.arrayGetLength() / 2;
+ const int length = obj2.arrayGetLength() / 2;
- assets = (Asset **)gmallocn(nAssets, sizeof(Asset *));
+ assets = (Asset **)gmallocn(length, sizeof(Asset *));
+ for (int i = 0; i < length; ++i) {
+ Object objKey = obj2.arrayGet(2 * i);
+ Object objVal = obj2.arrayGet(2 * i + 1);
- int counter = 0;
- for (int i = 0; i < nAssets; ++i) {
- assets[counter] = new AnnotRichMedia::Asset;
-
- Object objKey = obj2.arrayGet(i * 2);
- assets[counter]->fileSpec = obj2.arrayGet(i * 2 + 1);
-
- assets[counter]->name = new GooString( objKey.getString() );
- ++counter;
+ if (!objKey.isString() || objVal.isNull()) {
+ error(errSyntaxError, -1, "Bad Annot Asset");
+ continue;
+ }
+ assets[nAssets] = new AnnotRichMedia::Asset;
+ assets[nAssets]->name = new GooString( objKey.getString() );
+ assets[nAssets]->fileSpec = std::move(objVal);
+ ++nAssets;
}
}
}
--
2.20.1

View File

@ -1,28 +0,0 @@
From 6912e06d9ab19ba28991b5cab3319d61d856bd6d Mon Sep 17 00:00:00 2001
From: Adam Reichold <adam.reichold@t-online.de>
Date: Tue, 6 Nov 2018 09:00:02 +0100
Subject: [PATCH] Check for stream before calling stream methods when saving an
embedded file.
Closes #659
---
poppler/FileSpec.cc | 3 +++
1 file changed, 3 insertions(+)
diff --git a/poppler/FileSpec.cc b/poppler/FileSpec.cc
index 7479c2d2..d5543041 100644
--- a/poppler/FileSpec.cc
+++ b/poppler/FileSpec.cc
@@ -93,6 +93,9 @@ bool EmbFile::save(const char *path) {
GBool EmbFile::save2(FILE *f) {
int c;
+ if (unlikely(!m_objStr.isStream()))
+ return false;
+
m_objStr.streamReset();
while ((c = m_objStr.streamGetChar()) != EOF) {
fputc(c, f);
--
2.19.1

View File

@ -1,81 +0,0 @@
From d2f5d424ba8752f9a9e9dad410546ec1b46caa0a Mon Sep 17 00:00:00 2001
From: Adam Reichold <adam.reichold@t-online.de>
Date: Tue, 6 Nov 2018 09:08:06 +0100
Subject: [PATCH] pdfdetach: Check for valid file name of embedded file before
using it to determine save path.
Closes #660
---
utils/pdfdetach.cc | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/utils/pdfdetach.cc b/utils/pdfdetach.cc
index a8720c64..71fa8608 100644
--- a/utils/pdfdetach.cc
+++ b/utils/pdfdetach.cc
@@ -191,14 +191,18 @@ int main(int argc, char *argv[]) {
fileSpec = static_cast<FileSpec *>(embeddedFiles->get(i));
printf("%d: ", i+1);
s1 = fileSpec->getFileName();
- if ((s1->getChar(0) & 0xff) == 0xfe && (s1->getChar(1) & 0xff) == 0xff) {
+ if (!s1) {
+ exitCode = 3;
+ goto err2;
+ }
+ if (s1->hasUnicodeMarker()) {
isUnicode = gTrue;
j = 2;
} else {
isUnicode = gFalse;
j = 0;
}
- while (j < fileSpec->getFileName()->getLength()) {
+ while (j < s1->getLength()) {
if (isUnicode) {
u = ((s1->getChar(j) & 0xff) << 8) | (s1->getChar(j+1) & 0xff);
j += 2;
@@ -228,14 +232,18 @@ int main(int argc, char *argv[]) {
p = path;
}
s1 = fileSpec->getFileName();
- if ((s1->getChar(0) & 0xff) == 0xfe && (s1->getChar(1) & 0xff) == 0xff) {
+ if (!s1) {
+ exitCode = 3;
+ goto err2;
+ }
+ if (s1->hasUnicodeMarker()) {
isUnicode = gTrue;
j = 2;
} else {
isUnicode = gFalse;
j = 0;
}
- while (j < fileSpec->getFileName()->getLength()) {
+ while (j < s1->getLength()) {
if (isUnicode) {
u = ((s1->getChar(j) & 0xff) << 8) | (s1->getChar(j+1) & 0xff);
j += 2;
@@ -276,14 +284,18 @@ int main(int argc, char *argv[]) {
} else {
p = path;
s1 = fileSpec->getFileName();
- if ((s1->getChar(0) & 0xff) == 0xfe && (s1->getChar(1) & 0xff) == 0xff) {
+ if (!s1) {
+ exitCode = 3;
+ goto err2;
+ }
+ if (s1->hasUnicodeMarker()) {
isUnicode = gTrue;
j = 2;
} else {
isUnicode = gFalse;
j = 0;
}
- while (j < fileSpec->getFileName()->getLength()) {
+ while (j < s1->getLength()) {
if (isUnicode) {
u = ((s1->getChar(j) & 0xff) << 8) | (s1->getChar(j+1) & 0xff);
j += 2;
--
2.19.1

View File

@ -1,46 +0,0 @@
From 77a30e94d96220d7e22dff5b3f0a7f296f01b118 Mon Sep 17 00:00:00 2001
From: Adam Reichold <adam.reichold@t-online.de>
Date: Tue, 6 Nov 2018 09:13:41 +0100
Subject: [PATCH] pdfdetach: Check for valid embedded file before trying to
save it.
Closes #661
---
utils/pdfdetach.cc | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/utils/pdfdetach.cc b/utils/pdfdetach.cc
index 846584a4..a8720c64 100644
--- a/utils/pdfdetach.cc
+++ b/utils/pdfdetach.cc
@@ -251,7 +251,12 @@ int main(int argc, char *argv[]) {
}
*p = '\0';
- if (!fileSpec->getEmbeddedFile()->save(path)) {
+ auto *embFile = fileSpec->getEmbeddedFile();
+ if (!embFile || !embFile->isOk()) {
+ exitCode = 3;
+ goto err2;
+ }
+ if (!embFile->save(path)) {
error(errIO, -1, "Error saving embedded file as '{0:s}'", p);
exitCode = 2;
goto err2;
@@ -296,7 +301,12 @@ int main(int argc, char *argv[]) {
p = path;
}
- if (!fileSpec->getEmbeddedFile()->save(p)) {
+ auto *embFile = fileSpec->getEmbeddedFile();
+ if (!embFile || !embFile->isOk()) {
+ exitCode = 3;
+ goto err2;
+ }
+ if (!embFile->save(p)) {
error(errIO, -1, "Error saving embedded file as '{0:s}'", p);
exitCode = 2;
goto err2;
--
2.19.1

View File

@ -1,15 +1,15 @@
%global test_sha 0d2bfd4af4c76a3bac27ccaff793d9129df7b57a
%global test_date 2009-05-13
%global test_sha 45f55f1e03b9bf3fbd334c31776b6f5e472889ec
%global test_date 2018-12-18
Summary: PDF rendering library
Name: poppler
Version: 0.67.0
Release: 10%{?dist}
Version: 0.73.0
Release: 1%{?dist}
License: (GPLv2 or GPLv3) and GPLv2+ and LGPLv2+ and MIT
URL: http://poppler.freedesktop.org/
Source0: http://poppler.freedesktop.org/poppler-%{version}.tar.xz
# git archive --prefix test/
Source1: %{name}-test-%{test_date}_%{test_sha}.tar.xz
Source1: %{name}-test-%{test_date}-%{test_sha}.tar.xz
# https://bugzilla.redhat.com/show_bug.cgi?id=1185007
Patch0: poppler-0.30.0-rotated-words-selection.patch
@ -22,33 +22,6 @@ Patch6: poppler-0.63.0-tiling-patterns.patch
Patch7: poppler-0.67.0-qt4-const.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1569334
Patch8: poppler-0.67.0-embedded-file-check.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1626618
Patch9: poppler-0.67.0-cycles-in-pdf-parsing.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1649435
Patch10: poppler-0.67.0-stream-check.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1649440
Patch11: poppler-0.67.0-valid-embedded-file.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1649450
Patch12: poppler-0.67.0-valid-embedded-file-name.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1665259
Patch13: poppler-0.67.0-rich-media-annotation.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1665263
Patch14: poppler-0.67.0-filespec.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1665266
Patch15: poppler-0.67.0-dummy-xref-entry.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1646546
Patch16: poppler-0.67.0-display-profile.patch
BuildRequires: cmake
BuildRequires: gcc-c++
BuildRequires: gettext-devel
@ -187,7 +160,7 @@ export CC="gcc -fPIC" # hack to make the cmake call pass
-DENABLE_DCTDECODER=libjpeg \
-DENABLE_GTK_DOC=ON \
-DENABLE_LIBOPENJPEG=openjpeg2 \
-DENABLE_XPDF_HEADERS=ON \
-DENABLE_UNSTABLE_API_ABI_HEADERS=ON \
-DENABLE_ZLIB=OFF \
..
unset CC
@ -222,7 +195,7 @@ test "$(pkg-config --modversion poppler-splash)" = "%{version}"
%files
%doc README
%license COPYING
%{_libdir}/libpoppler.so.78*
%{_libdir}/libpoppler.so.84*
%files devel
%{_libdir}/pkgconfig/poppler.pc
@ -279,6 +252,9 @@ test "$(pkg-config --modversion poppler-splash)" = "%{version}"
%{_mandir}/man1/*
%changelog
* Fri Jan 25 2019 Marek Kasik <mkasik@redhat.com> - 0.73.0-1
- Update to 0.73.0
* Tue Jan 22 2019 Marek Kasik <mkasik@redhat.com> - 0.67.0-10
- Avoid global display profile state becoming an uncontrolled
- memory leak

View File

@ -1,2 +1,2 @@
SHA512 (poppler-0.67.0.tar.xz) = 36584c62970ae0ae7807687f9c0523560ae92ac323949be8916a0e8dc6e691633e55cdd76c6026253c337aed8a4b43a7759a3de74c9ec606654f65379fb0f206
SHA512 (poppler-test-2009-05-13_0d2bfd4af4c76a3bac27ccaff793d9129df7b57a.tar.xz) = f8ce114357043a893100de2d52ada8bd850148d19f0e8c889988ea97e9a92313f0545c0b88ef32a1ce7f0e9e58edc1a8c9066278c20b7718ca619913fd4bfb3c
SHA512 (poppler-0.73.0.tar.xz) = 6924a343032573504a0039c56a6263cd1183fa6aca75966fe1f084bd19da78553e455e541a3693896c1ed0c3865f11c11758a0f5a66b2f6cd48ac8a7eccf891a
SHA512 (poppler-test-2018-12-18-45f55f1e03b9bf3fbd334c31776b6f5e472889ec.tar.xz) = fa1d8c92ca5bc9ebd7453dfb78f34fb44d014621fe698aa4a3fa9bd17bd0d302ca6ba36f4dd46a1ef030c0b7a30729d4bacb6d01c5c67d429c897e4f5ab331e8