!18 update poppler to 0.90.0

From: @chen-jan
Reviewed-by: @small_leek
Signed-off-by: @small_leek
This commit is contained in:
openeuler-ci-bot 2021-09-01 07:39:51 +00:00 committed by Gitee
commit 41ff9c50c1
32 changed files with 495 additions and 28039 deletions

File diff suppressed because it is too large Load Diff

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.24.1

View File

@ -1,45 +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
@@ -250,7 +250,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;
@@ -295,7 +300,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.24.1

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
@@ -132,11 +132,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.24.1

View File

@ -1,46 +0,0 @@
From 7b4e372deeb716eb3fe3a54b31ed41af759224f9 Mon Sep 17 00:00:00 2001
From: Marek Kasik <mkasik@redhat.com>
Date: Mon, 4 Mar 2019 12:55:12 +0100
Subject: [PATCH] pdfunite: Check XRef's Catalog for being a Dict
Check whether Catalog from XRef is Dict for each document
passed to pdfunite and return error if not.
https://gitlab.freedesktop.org/poppler/poppler/issues/706
---
utils/pdfunite.cc | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/utils/pdfunite.cc b/utils/pdfunite.cc
index b0142116..23888684 100644
--- a/utils/pdfunite.cc
+++ b/utils/pdfunite.cc
@@ -165,7 +165,8 @@ 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();
@@ -176,8 +177,13 @@ int main (int argc, char *argv[])
}
}
} else if (doc->isOk()) {
- error(errUnimplemented, -1, "Could not merge encrypted files ('{0:s}')", argv[i]);
- return -1;
+ 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, "XRef's 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;
--
2.21.0

View File

@ -1,28 +0,0 @@
From 9fd5ec0e6e5f763b190f2a55ceb5427cfe851d5f Mon Sep 17 00:00:00 2001
From: Albert Astals Cid <aacid@kde.org>
Date: Mon, 31 Dec 2018 11:47:57 +0100
Subject: [PATCH] PDFDoc::setup: Fix return value
At that point xref can have gone wrong since extractPDFSubtype() can
have caused a reconstruct that broke stuff so instead of unconditionally
returning true, return xref->isOk()
Fixes #706
---
poppler/PDFDoc.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc
index 351bd2ea..9213f567 100644
--- a/poppler/PDFDoc.cc
+++ b/poppler/PDFDoc.cc
@@ -312,6 +312,6 @@ bool PDFDoc::setup(const GooString *ownerPassword, const GooString *userPassword
// done
- return gTrue;
+ return xref->isOk();
}
PDFDoc::~PDFDoc() {
--
2.21.0

View File

@ -1,141 +0,0 @@
From 6a1580e84f492b5671d23be98192267bb73de250 Mon Sep 17 00:00:00 2001
From: Marek Kasik <mkasik@redhat.com>
Date: Mon, 13 May 2019 15:08:38 +0200
Subject: [PATCH] Splash: Restrict filling of overlapping boxes
Check whether area to fill in Splash::blitTransparent()
does not run out of allocated memory for source and for destination
and shrink it if needed.
Fixes #750
---
splash/Splash.cc | 48 +++++++++++++++++++++++++++++++++---------------
1 file changed, 33 insertions(+), 15 deletions(-)
diff --git a/splash/Splash.cc b/splash/Splash.cc
index 0a06f9c8..4ac163e4 100644
--- a/splash/Splash.cc
+++ b/splash/Splash.cc
@@ -5853,7 +5853,7 @@ SplashError Splash::blitTransparent(SplashBitmap *src, int xSrc, int ySrc,
int xDest, int yDest, int w, int h) {
SplashColorPtr p, sp;
Guchar *q;
- int x, y, mask, srcMask;
+ int x, y, mask, srcMask, width = w, height = h;
if (src->mode != bitmap->mode) {
return splashErrModeMismatch;
@@ -5863,14 +5863,32 @@ SplashError Splash::blitTransparent(SplashBitmap *src, int xSrc, int ySrc,
return splashErrZeroImage;
}
+ if (src->getWidth() - xSrc < width)
+ width = src->getWidth() - xSrc;
+
+ if (src->getHeight() - ySrc < height)
+ height = src->getHeight() - ySrc;
+
+ if (bitmap->getWidth() - xDest < width)
+ width = bitmap->getWidth() - xDest;
+
+ if (bitmap->getHeight() - yDest < height)
+ height = bitmap->getHeight() - yDest;
+
+ if (width < 0)
+ width = 0;
+
+ if (height < 0)
+ height = 0;
+
switch (bitmap->mode) {
case splashModeMono1:
- for (y = 0; y < h; ++y) {
+ for (y = 0; y < height; ++y) {
p = &bitmap->data[(yDest + y) * bitmap->rowSize + (xDest >> 3)];
mask = 0x80 >> (xDest & 7);
sp = &src->data[(ySrc + y) * src->rowSize + (xSrc >> 3)];
srcMask = 0x80 >> (xSrc & 7);
- for (x = 0; x < w; ++x) {
+ for (x = 0; x < width; ++x) {
if (*sp & srcMask) {
*p |= mask;
} else {
@@ -5888,20 +5906,20 @@ SplashError Splash::blitTransparent(SplashBitmap *src, int xSrc, int ySrc,
}
break;
case splashModeMono8:
- for (y = 0; y < h; ++y) {
+ for (y = 0; y < height; ++y) {
p = &bitmap->data[(yDest + y) * bitmap->rowSize + xDest];
sp = &src->data[(ySrc + y) * bitmap->rowSize + xSrc];
- for (x = 0; x < w; ++x) {
+ for (x = 0; x < width; ++x) {
*p++ = *sp++;
}
}
break;
case splashModeRGB8:
case splashModeBGR8:
- for (y = 0; y < h; ++y) {
+ for (y = 0; y < height; ++y) {
p = &bitmap->data[(yDest + y) * bitmap->rowSize + 3 * xDest];
sp = &src->data[(ySrc + y) * src->rowSize + 3 * xSrc];
- for (x = 0; x < w; ++x) {
+ for (x = 0; x < width; ++x) {
*p++ = *sp++;
*p++ = *sp++;
*p++ = *sp++;
@@ -5909,10 +5927,10 @@ SplashError Splash::blitTransparent(SplashBitmap *src, int xSrc, int ySrc,
}
break;
case splashModeXBGR8:
- for (y = 0; y < h; ++y) {
+ for (y = 0; y < height; ++y) {
p = &bitmap->data[(yDest + y) * bitmap->rowSize + 4 * xDest];
sp = &src->data[(ySrc + y) * src->rowSize + 4 * xSrc];
- for (x = 0; x < w; ++x) {
+ for (x = 0; x < width; ++x) {
*p++ = *sp++;
*p++ = *sp++;
*p++ = *sp++;
@@ -5923,10 +5941,10 @@ SplashError Splash::blitTransparent(SplashBitmap *src, int xSrc, int ySrc,
break;
#ifdef SPLASH_CMYK
case splashModeCMYK8:
- for (y = 0; y < h; ++y) {
+ for (y = 0; y < height; ++y) {
p = &bitmap->data[(yDest + y) * bitmap->rowSize + 4 * xDest];
sp = &src->data[(ySrc + y) * src->rowSize + 4 * xSrc];
- for (x = 0; x < w; ++x) {
+ for (x = 0; x < width; ++x) {
*p++ = *sp++;
*p++ = *sp++;
*p++ = *sp++;
@@ -5935,10 +5953,10 @@ SplashError Splash::blitTransparent(SplashBitmap *src, int xSrc, int ySrc,
}
break;
case splashModeDeviceN8:
- for (y = 0; y < h; ++y) {
+ for (y = 0; y < height; ++y) {
p = &bitmap->data[(yDest + y) * bitmap->rowSize + (SPOT_NCOMPS+4) * xDest];
sp = &src->data[(ySrc + y) * src->rowSize + (SPOT_NCOMPS+4) * xSrc];
- for (x = 0; x < w; ++x) {
+ for (x = 0; x < width; ++x) {
for (int cp=0; cp < SPOT_NCOMPS+4; cp++)
*p++ = *sp++;
}
@@ -5948,9 +5966,9 @@ SplashError Splash::blitTransparent(SplashBitmap *src, int xSrc, int ySrc,
}
if (bitmap->alpha) {
- for (y = 0; y < h; ++y) {
+ for (y = 0; y < height; ++y) {
q = &bitmap->alpha[(yDest + y) * bitmap->width + xDest];
- memset(q, 0x00, w);
+ memset(q, 0x00, width);
}
}
--
GitLab

View File

@ -1,35 +0,0 @@
From 8051f678b3b43326e5fdfd7c03f39de21059f426 Mon Sep 17 00:00:00 2001
From: Albert Astals Cid <aacid@kde.org>
Date: Fri, 5 Apr 2019 16:34:48 +0200
Subject: [PATCH] FontInfoScanner::scanFonts Fix infinite loop in broken files
Fixes #752
---
poppler/FontInfo.cc | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/poppler/FontInfo.cc b/poppler/FontInfo.cc
index 2c3be4c6..cd335771 100644
--- a/poppler/FontInfo.cc
+++ b/poppler/FontInfo.cc
@@ -144,7 +144,17 @@ void FontInfoScanner::scanFonts(XRef *xrefA, Dict *resDict, std::vector<FontInfo
Object obj2 = obj1.fetch(xrefA);
if (obj2.isStream()) {
- Object resObj = obj2.streamGetDict()->lookup("Resources");
+ Ref resourcesRef;
+ const Object resObj = obj2.streamGetDict()->lookup("Resources");
+
+ if (resourcesRef.num != -1) {
+ if (visitedObjects.find(resourcesRef.num) != visitedObjects.end()) {
+ continue;
+ }
+
+ visitedObjects.insert(resourcesRef.num);
+ }
+
if (resObj.isDict() && resObj.getDict() != resDict) {
scanFonts(xrefA, resObj.getDict(), fontsList);
}
--
2.20.1

View File

@ -1,35 +0,0 @@
From d716e636231c8d636bf2139896d817b66fe6d510 Mon Sep 17 00:00:00 2001
From: Marek Kasik <mkasik@redhat.com>
Date: Thu, 21 Mar 2019 13:15:37 +0100
Subject: [PATCH] cairo: Compute correct coverage values for box filter
Use double precision for computation of coverage
of the left most pixel in the box filter.
Issue #736
---
poppler/CairoRescaleBox.cc | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/poppler/CairoRescaleBox.cc b/poppler/CairoRescaleBox.cc
index b8371a5b..d7615010 100644
--- a/poppler/CairoRescaleBox.cc
+++ b/poppler/CairoRescaleBox.cc
@@ -226,10 +227,10 @@ static int compute_coverage (int coverage[], int src_length, int dest_length)
/* I have a proof of this, which this margin is too narrow to contain */
for (i=0; i<dest_length; i++)
{
- float left_side = i*scale;
- float right_side = (i+1)*scale;
- float right_fract = right_side - floor (right_side);
- float left_fract = ceil (left_side) - left_side;
+ double left_side = i*scale;
+ double right_side = (i+1)*scale;
+ double right_fract = right_side - floor (right_side);
+ double left_fract = ceil (left_side) - left_side;
int overage;
/* find out how many source pixels will be used to fill the box */
int count = floor (right_side) - ceil (left_side);
--
2.21.0

View File

@ -1,100 +0,0 @@
From 8122f6d6d409b53151a20c5578fc525ee97315e8 Mon Sep 17 00:00:00 2001
From: Marek Kasik <mkasik@redhat.com>
Date: Thu, 21 Mar 2019 13:47:51 +0100
Subject: [PATCH] cairo: Constrain number of cycles in rescale filter
Pass address of the first byte after end of the source buffer
to downsample_row_box_filter() so that we can check
that we don't run out of it.
Fixes issue #736
---
poppler/CairoRescaleBox.cc | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/poppler/CairoRescaleBox.cc b/poppler/CairoRescaleBox.cc
index d7615010..7fd07041 100644
--- a/poppler/CairoRescaleBox.cc
+++ b/poppler/CairoRescaleBox.cc
@@ -62,7 +62,7 @@
static void downsample_row_box_filter (
int start, int width,
- uint32_t *src, uint32_t *dest,
+ uint32_t *src, uint32_t *src_limit, uint32_t *dest,
int coverage[], int pixel_coverage)
{
/* we need an array of the pixel contribution of each destination pixel on the boundaries.
@@ -90,13 +90,13 @@ static void downsample_row_box_filter (
/* skip to start */
/* XXX: it might be possible to do this directly instead of iteratively, however
* the iterative solution is simple */
- while (x < start)
+ while (x < start && src < src_limit)
{
int box = 1 << FIXED_SHIFT;
int start_coverage = coverage[x];
box -= start_coverage;
src++;
- while (box >= pixel_coverage)
+ while (box >= pixel_coverage && src < src_limit)
{
src++;
box -= pixel_coverage;
@@ -104,7 +104,7 @@ static void downsample_row_box_filter (
x++;
}
- while (x < start + width)
+ while (x < start + width && src < src_limit)
{
uint32_t a = 0;
uint32_t r = 0;
@@ -121,7 +121,7 @@ static void downsample_row_box_filter (
x++;
box -= start_coverage;
- while (box >= pixel_coverage)
+ while (box >= pixel_coverage && src < src_limit)
{
a += ((*src >> 24) & 0xff) * pixel_coverage;
r += ((*src >> 16) & 0xff) * pixel_coverage;
@@ -135,7 +135,7 @@ static void downsample_row_box_filter (
/* multiply by whatever is leftover
* this ensures that we don't bias down.
* i.e. start_coverage + n*pixel_coverage + box == 1 << 24 */
- if (box > 0)
+ if (box > 0 && src < src_limit)
{
a += ((*src >> 24) & 0xff) * box;
r += ((*src >> 16) & 0xff) * box;
@@ -337,7 +337,7 @@ bool CairoRescaleBox::downScaleImage(unsigned orig_width, unsigned orig_height,
int start_coverage_y = y_coverage[dest_y];
getRow(src_y, scanline);
- downsample_row_box_filter (start_column, width, scanline, temp_buf + width * columns, x_coverage, pixel_coverage_x);
+ downsample_row_box_filter (start_column, width, scanline, scanline + orig_width, temp_buf + width * columns, x_coverage, pixel_coverage_x);
columns++;
src_y++;
box -= start_coverage_y;
@@ -345,7 +345,7 @@ bool CairoRescaleBox::downScaleImage(unsigned orig_width, unsigned orig_height,
while (box >= pixel_coverage_y)
{
getRow(src_y, scanline);
- downsample_row_box_filter (start_column, width, scanline, temp_buf + width * columns, x_coverage, pixel_coverage_x);
+ downsample_row_box_filter (start_column, width, scanline, scanline + orig_width, temp_buf + width * columns, x_coverage, pixel_coverage_x);
columns++;
src_y++;
box -= pixel_coverage_y;
@@ -355,7 +355,7 @@ bool CairoRescaleBox::downScaleImage(unsigned orig_width, unsigned orig_height,
if (box > 0)
{
getRow(src_y, scanline);
- downsample_row_box_filter (start_column, width, scanline, temp_buf + width * columns, x_coverage, pixel_coverage_x);
+ downsample_row_box_filter (start_column, width, scanline, scanline + orig_width, temp_buf + width * columns, x_coverage, pixel_coverage_x);
columns++;
}
--
2.21.0

View File

@ -1,26 +0,0 @@
From fada09a2ccc11a3a1d308e810f1336d8df6011fd Mon Sep 17 00:00:00 2001
From: Albert Astals Cid <aacid@kde.org>
Date: Mon, 18 Mar 2019 00:50:00 +0100
Subject: [PATCH] pdfunite: Fix stack overflow on broken file
Fixes issue #741
---
poppler/PDFDoc.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc
index 26842f84..ab4abcad 100644
--- a/poppler/PDFDoc.cc
+++ b/poppler/PDFDoc.cc
@@ -1703,7 +1703,7 @@ void PDFDoc::markObject (Object* obj, XRef *xRef, XRef *countRef, unsigned int n
array = obj->getArray();
for (int i=0; i<array->getLength(); i++) {
Object obj1 = array->getNF(i);
- markObject(&obj1, xRef, countRef, numOffset, oldRefNum, newRefNum);
+ markObject(&obj1, xRef, countRef, numOffset, oldRefNum, newRefNum, alreadyMarkedDicts);
}
break;
case objDict:
--
2.21.0

View File

@ -1,22 +0,0 @@
From 68ef84e5968a4249c2162b839ca6d7975048a557 Mon Sep 17 00:00:00 2001
From: Albert Astals Cid <aacid@kde.org>
Date: Mon, 15 Jul 2019 23:24:22 +0200
Subject: [PATCH] JPXStream::init: ignore dict Length if clearly broken
Fixes issue #805
---
poppler/JPEG2000Stream.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff -Nurp poppler-0.67.0/poppler/JPEG2000Stream.cc poppler-0.67.0-bak/poppler/JPEG2000Stream.cc
--- poppler-0.67.0/poppler/JPEG2000Stream.cc 2018-07-19 17:20:03.000000000 -0400
+++ poppler-0.67.0-bak/poppler/JPEG2000Stream.cc 2019-08-15 14:10:20.618000000 -0400
@@ -219,7 +219,7 @@ void JPXStream::init()
}
int bufSize = BUFFER_INITIAL_SIZE;
- if (oLen.isInt()) bufSize = oLen.getInt();
+ if (oLen.isInt() && oLen.getInt() > 0) bufSize = oLen.getInt();
GBool indexed = gFalse;
if (cspace.isArray() && cspace.arrayGetLength() > 0) {

View File

@ -1,61 +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 bd4845ab6..8f48efbe3 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;
+
+ 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 11ee5e033..2eb2f9fdc 100644
--- a/poppler/XRef.h
+++ b/poppler/XRef.h
@@ -65,6 +65,7 @@ struct XRefEntry {
enum Flag {
// Regular flags
Updated, // Entry was modified
+ Parsing, // Entry is currently being parsed
// Special flags -- available only after xref->scanSpecialFlags() is run
Unencrypted, // Entry is stored in unencrypted form (meaningless in unencrypted documents)
--
GitLab

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 87b7ce03d..4e3ccbfda 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 4f06c47e2..ddac7dfb7 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);
--
GitLab

View File

@ -1,66 +0,0 @@
diff -Nuar poppler-0.67.0/utils/pdfdetach.cc poppler-0.67.0-old/utils/pdfdetach.cc
--- poppler-0.67.0/utils/pdfdetach.cc 2021-01-18 15:08:35.960000000 +0800
+++ poppler-0.67.0-old/utils/pdfdetach.cc 2021-01-18 15:29:05.580000000 +0800
@@ -190,14 +190,18 @@
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;
@@ -227,14 +231,18 @@
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;
@@ -275,14 +283,18 @@
} 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;

View File

@ -1,49 +0,0 @@
diff -Nuar poppler-0.67.0/poppler/XRef.cc poppler-0.67.0-old/poppler/XRef.cc
--- poppler-0.67.0/poppler/XRef.cc 2018-07-20 05:20:03.000000000 +0800
+++ poppler-0.67.0-old/poppler/XRef.cc 2021-01-18 15:56:14.964000000 +0800
@@ -1611,11 +1611,31 @@
}
}
+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);
}
@@ -1626,12 +1646,7 @@
// 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) {

View File

@ -1,28 +0,0 @@
From b224e2f5739fe61de9fa69955d016725b2a4b78d Mon Sep 17 00:00:00 2001
From: Albert Astals Cid <aacid@kde.org>
Date: Mon, 15 Jul 2019 22:11:09 +0200
Subject: [PATCH] SplashOutputDev::tilingPatternFill: Fix crash on broken file
Issue #802
---
poppler/SplashOutputDev.cc | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc
index 544f132da..3d2befc28 100644
--- a/poppler/SplashOutputDev.cc
+++ b/poppler/SplashOutputDev.cc
@@ -4581,6 +4581,10 @@ bool SplashOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *cat
surface_width = (int) ceil (fabs(kx));
surface_height = (int) ceil (fabs(ky));
// adjust repeat values to completely fill region
+ if (unlikely(surface_width == 0 || surface_height == 0)) {
+ state->setCTM(savedCTM[0], savedCTM[1], savedCTM[2], savedCTM[3], savedCTM[4], savedCTM[5]);
+ return false;
+ }
repeatX = result_width / surface_width;
repeatY = result_height / surface_height;
if (surface_width * repeatX < result_width)
--
GitLab

View File

@ -1,15 +0,0 @@
diff -Nuar poppler-0.67.0/poppler/XRef.cc poppler-0.67.0-old/poppler/XRef.cc
--- poppler-0.67.0/poppler/XRef.cc 2021-01-18 16:24:55.368000000 +0800
+++ poppler-0.67.0-old/poppler/XRef.cc 2021-01-18 16:29:29.936000000 +0800
@@ -1628,6 +1628,11 @@
XRefEntry *XRef::getEntry(int i, GBool complainIfMissing)
{
+ if (unlikely(i < 0)) {
+ error(errInternal, -1, "Request for invalid XRef entry [{0:d}]", i);
+ return &dummyXRefEntry;
+ }
+
if (i >= size || entries[i].type == xrefEntryNone) {
if ((!xRefStream) && mainXRefEntriesOffset) {

View File

@ -17,18 +17,18 @@ index 7c2ca78..e93908c 100644
--- a/poppler/TextOutputDev.cc
+++ b/poppler/TextOutputDev.cc
@@ -178,6 +178,12 @@
#define combMaxMidDelta 0.3
#define combMaxBaseDelta 0.4
// (Or 1/tan(angle) for 90/270 degrees.)
#define diagonalThreshold 0.1
+// Returns whether x is between a and b or equal to a or b.
+// 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

@ -1,8 +0,0 @@
--- poppler-0.63.0/make-glib-api-docs
+++ poppler-0.63.0/make-glib-api-docs
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
#
# Copyright (C) 2017 Carlos Garcia Campos <carlosgc@gnome.org>
#

View File

@ -1,47 +0,0 @@
From 718d428984e3a84fda521c0f5e6d975c7390af2b Mon Sep 17 00:00:00 2001
From: Marek Kasik <mkasik@redhat.com>
Date: Fri, 6 Apr 2018 15:06:46 +0200
Subject: [PATCH] cairo: Fix tiling patterns when pattern cell is too far
Rendering of tiling pattern which has pattern matrix moving pattern cell
far away can fail on allocation of memory. This commit solves the issue by
modifying of cairo pattern matrix so that its offset is closer to the path
filled by the pattern.
https://bugs.freedesktop.org/show_bug.cgi?id=105905
---
poppler/CairoOutputDev.cc | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc
index 631ab27b..b2e730bf 100644
--- a/poppler/CairoOutputDev.cc
+++ b/poppler/CairoOutputDev.cc
@@ -915,6 +915,8 @@ GBool CairoOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *cat
StrokePathClip *strokePathTmp;
GBool adjusted_stroke_width_tmp;
cairo_pattern_t *maskTmp;
+ double xoffset, yoffset;
+ double det;
width = bbox[2] - bbox[0];
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;
+ det = pmat[0] * pmat[3] - pmat[1] * pmat[2];
+ if (fabs(det) < 0.000001)
+ return gFalse;
+
+ xoffset = round ((pmat[3] * pmat[4] - pmat[2] * pmat[5]) / (xStep * det));
+ yoffset = - round ((pmat[1] * pmat[4] - pmat[0] * pmat[5]) / (yStep * det));
+ pattern_matrix.x0 -= xoffset * pattern_matrix.xx * xStep + yoffset * pattern_matrix.xy * yStep;
+ pattern_matrix.y0 -= xoffset * pattern_matrix.yx * xStep + yoffset * pattern_matrix.yy * yStep;
+
state->getUserClipBBox(&xMin, &yMin, &xMax, &yMax);
cairo_rectangle (cairo, xMin, yMin, xMax - xMin, yMax - yMin);
--
2.14.3

View File

@ -1,404 +0,0 @@
--- 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 {
if ( !outline )
return NULL;
- GooList * items = outline->getItems();
+ const GooList * items = outline->getItems();
if ( !items || items->getLength() < 1 )
return NULL;
@@ -799,7 +799,7 @@ namespace Poppler {
return Document::NoForm; // make gcc happy
}
- QDateTime convertDate( char *dateString )
+ QDateTime convertDate( const char *dateString )
{
int year, mon, day, hour, min, sec, tzHours, tzMins;
char tz;
@@ -830,6 +830,12 @@ namespace Poppler {
return QDateTime();
}
+ QDateTime convertDate( char *dateString )
+ {
+ return convertDate( (const char *) dateString );
+ }
+
+
bool isCmsAvailable()
{
#if defined(USE_CMS)
--- poppler-0.67.0/qt4/src/poppler-embeddedfile.cc.orig 2018-08-08 10:13:17.130028069 +0200
+++ poppler-0.67.0/qt4/src/poppler-embeddedfile.cc 2018-08-08 10:50:42.645723179 +0200
@@ -68,13 +68,13 @@ EmbeddedFile::~EmbeddedFile()
QString EmbeddedFile::name() const
{
- GooString *goo = m_embeddedFile->filespec->getFileName();
+ const GooString *goo = m_embeddedFile->filespec->getFileName();
return goo ? UnicodeParsedString(goo) : QString();
}
QString EmbeddedFile::description() const
{
- GooString *goo = m_embeddedFile->filespec->getDescription();
+ const GooString *goo = m_embeddedFile->filespec->getDescription();
return goo ? UnicodeParsedString(goo) : QString();
}
@@ -85,25 +85,25 @@ int EmbeddedFile::size() const
QDateTime EmbeddedFile::modDate() const
{
- 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();
}
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();
}
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();
}
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();
}
--- 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
m_movieData->m_movieObj = ann->getMovie()->copy();
//TODO: copy poster image
- MovieActivationParameters *mp = m_movieData->m_movieObj->getActivationParameters();
+ const MovieActivationParameters *mp = m_movieData->m_movieObj->getActivationParameters();
int width, height;
m_movieData->m_movieObj->getFloatingWindowSize(&width, &height);
m_movieData->m_size = QSize(width, height);
@@ -73,7 +73,7 @@ MovieObject::~MovieObject()
QString MovieObject::url() const
{
- GooString * goo = m_movieData->m_movieObj->getFileName();
+ const GooString * goo = m_movieData->m_movieObj->getFileName();
return goo ? QString( goo->getCString() ) : 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;
namespace Poppler {
/* borrowed from kpdf */
- QString unicodeToQString(Unicode* u, int len);
+ QString unicodeToQString(const Unicode* u, int len);
- QString UnicodeParsedString(GooString *s1);
+ QString UnicodeParsedString(const GooString *s1);
GooString *QStringToUnicodeGooString(const QString &s);
@@ -69,13 +69,13 @@ namespace Poppler {
class LinkDestinationData
{
public:
- LinkDestinationData( LinkDest *l, GooString *nd, Poppler::DocumentData *pdfdoc, bool external )
+ LinkDestinationData( const LinkDest *l, const GooString *nd, Poppler::DocumentData *pdfdoc, bool external )
: ld(l), namedDest(nd), doc(pdfdoc), externalDest(external)
{
}
- LinkDest *ld;
- GooString *namedDest;
+ const LinkDest *ld;
+ const GooString *namedDest;
Poppler::DocumentData *doc;
bool externalDest;
};
@@ -115,7 +115,7 @@ namespace Poppler {
~DocumentData();
- void addTocChildren( QDomDocument * docSyn, QDomNode * parent, GooList * items );
+ void addTocChildren( QDomDocument * docSyn, QDomNode * parent, const GooList * items );
void setPaperColor(const QColor &color)
{
--- poppler-0.67.0/qt4/src/poppler-qt4.h.orig 2018-08-08 10:13:17.133028093 +0200
+++ poppler-0.67.0/qt4/src/poppler-qt4.h 2018-08-08 10:29:23.807858790 +0200
@@ -1816,7 +1816,12 @@ height = dummy.height();
/**
Conversion from PDF date string format to QDateTime
*/
- POPPLER_QT4_EXPORT QDateTime convertDate( char *dateString );
+ POPPLER_QT4_EXPORT Q_DECL_DEPRECATED QDateTime convertDate( char *dateString );
+
+ /**
+ Conversion from PDF date string format to QDateTime
+ */
+ POPPLER_QT4_EXPORT QDateTime convertDate( const char *dateString );
/**
Whether the color management functions are available.
--- poppler-0.67.0/qt4/src/poppler-sound.cc.orig 2018-08-08 10:13:17.133028093 +0200
+++ poppler-0.67.0/qt4/src/poppler-sound.cc 2018-08-08 11:10:31.644004477 +0200
@@ -75,7 +75,7 @@ QString SoundObject::url() const
if ( m_soundData->m_type != SoundObject::External )
return QString();
- GooString * goo = m_soundData->m_soundObj->getFileName();
+ const GooString * goo = m_soundData->m_soundObj->getFileName();
return goo ? QString( goo->getCString() ) : QString();
}

Binary file not shown.

View File

@ -0,0 +1,289 @@
From 9bcc9d0a164dbd1f24aae8f900c28feafd0cb3f2 Mon Sep 17 00:00:00 2001
From: Marek Kasik <mkasik@redhat.com>
Date: Tue, 30 Apr 2019 18:47:44 +0200
Subject: [PATCH] PSOutputDev: Don't read outside of image buffer
Check whether input image is RGB or BGR to not treat
it as CMYK in those cases in PSOutputDev::checkPageSlice().
Fixes #751
---
poppler/PSOutputDev.cc | 248 ++++++++++++++++++++++++++++++++---------
1 file changed, 196 insertions(+), 52 deletions(-)
diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index 0d201835..155a8cbe 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -3374,6 +3374,14 @@ bool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/,
}
break;
case psLevel1Sep:
+ GfxColor inputColor;
+ GfxCMYK cmyk;
+ unsigned char cmykColor[4];
+ GfxDeviceRGBColorSpace *rgbCS;
+ SplashColorMode colorMode;
+
+ colorMode = bitmap->getMode();
+
p = bitmap->getDataPtr();
// Check for an all gray image
if (getOptimizeColorSpace()) {
@@ -3448,65 +3456,201 @@ bool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/,
}
} else if (((psProcessCyan | psProcessMagenta | psProcessYellow | psProcessBlack) & ~processColors) != 0) {
// Color image, need to check color flags for each dot
- for (y = 0; y < h; ++y) {
- for (comp = 0; comp < 4; ++comp) {
- if (useBinary) {
- // Binary color image
- for (x = 0; x < w; ++x) {
- col[comp] |= p[4*x + comp];
- hexBuf[i++] = p[4*x + comp];
- if (i >= 64) {
- writePSBuf(hexBuf, i);
- i = 0;
+ switch (colorMode) {
+ case splashModeRGB8:
+ case splashModeBGR8:
+ rgbCS = new GfxDeviceRGBColorSpace();
+ for (y = 0; y < h; ++y) {
+ for (comp = 0; comp < 4; ++comp) {
+ if (useBinary) {
+ // Binary color image
+ for (x = 0; x < w; ++x) {
+ if (likely(colorMode == splashModeRGB8)) {
+ inputColor.c[0] = byteToCol(p[3*x + 0]);
+ inputColor.c[1] = byteToCol(p[3*x + 1]);
+ inputColor.c[2] = byteToCol(p[3*x + 2]);
+ } else {
+ inputColor.c[0] = byteToCol(p[3*x + 2]);
+ inputColor.c[1] = byteToCol(p[3*x + 1]);
+ inputColor.c[2] = byteToCol(p[3*x + 0]);
+ }
+ rgbCS->getCMYK(&inputColor, &cmyk);
+ cmykColor[0] = colToByte(cmyk.c);
+ cmykColor[1] = colToByte(cmyk.m);
+ cmykColor[2] = colToByte(cmyk.y);
+ cmykColor[3] = colToByte(cmyk.k);
+
+ col[comp] |= cmykColor[comp];
+ hexBuf[i++] = cmykColor[comp];
+ if (i >= 64) {
+ writePSBuf(hexBuf, i);
+ i = 0;
+ }
+ }
+ } else {
+ // Gray color image
+ for (x = 0; x < w; ++x) {
+ if (likely(colorMode == splashModeRGB8)) {
+ inputColor.c[0] = byteToCol(p[3*x + 0]);
+ inputColor.c[1] = byteToCol(p[3*x + 1]);
+ inputColor.c[2] = byteToCol(p[3*x + 2]);
+ } else {
+ inputColor.c[0] = byteToCol(p[3*x + 2]);
+ inputColor.c[1] = byteToCol(p[3*x + 1]);
+ inputColor.c[2] = byteToCol(p[3*x + 0]);
+ }
+ rgbCS->getCMYK(&inputColor, &cmyk);
+ cmykColor[0] = colToByte(cmyk.c);
+ cmykColor[1] = colToByte(cmyk.m);
+ cmykColor[2] = colToByte(cmyk.y);
+ cmykColor[3] = colToByte(cmyk.k);
+
+ col[comp] |= cmykColor[comp];
+ digit = cmykColor[comp] / 16;
+ hexBuf[i++] = digit + ((digit >= 10)? 'a' - 10: '0');
+ digit = cmykColor[comp] % 16;
+ hexBuf[i++] = digit + ((digit >= 10)? 'a' - 10: '0');
+ if (i >= 64) {
+ hexBuf[i++] = '\n';
+ writePSBuf(hexBuf, i);
+ i = 0;
+ }
+ }
}
- }
- } else {
- // Gray color image
- for (x = 0; x < w; ++x) {
- col[comp] |= p[4*x + comp];
- digit = p[4*x + comp] / 16;
- hexBuf[i++] = digit + ((digit >= 10)? 'a' - 10: '0');
- digit = p[4*x + comp] % 16;
- hexBuf[i++] = digit + ((digit >= 10)? 'a' - 10: '0');
- if (i >= 64) {
- hexBuf[i++] = '\n';
- writePSBuf(hexBuf, i);
- i = 0;
+ }
+ p -= bitmap->getRowSize();
+ }
+ delete rgbCS;
+ break;
+ default:
+ for (y = 0; y < h; ++y) {
+ for (comp = 0; comp < 4; ++comp) {
+ if (useBinary) {
+ // Binary color image
+ for (x = 0; x < w; ++x) {
+ col[comp] |= p[4*x + comp];
+ hexBuf[i++] = p[4*x + comp];
+ if (i >= 64) {
+ writePSBuf(hexBuf, i);
+ i = 0;
+ }
+ }
+ } else {
+ // Gray color image
+ for (x = 0; x < w; ++x) {
+ col[comp] |= p[4*x + comp];
+ digit = p[4*x + comp] / 16;
+ hexBuf[i++] = digit + ((digit >= 10)? 'a' - 10: '0');
+ digit = p[4*x + comp] % 16;
+ hexBuf[i++] = digit + ((digit >= 10)? 'a' - 10: '0');
+ if (i >= 64) {
+ hexBuf[i++] = '\n';
+ writePSBuf(hexBuf, i);
+ i = 0;
+ }
+ }
}
- }
- }
- }
- p -= bitmap->getRowSize();
+ }
+ p -= bitmap->getRowSize();
+ }
+ break;
}
} else {
// Color image, do not need to check color flags
- for (y = 0; y < h; ++y) {
- for (comp = 0; comp < 4; ++comp) {
- if (useBinary) {
- // Binary color image
- for (x = 0; x < w; ++x) {
- hexBuf[i++] = p[4*x + comp];
- if (i >= 64) {
- writePSBuf(hexBuf, i);
- i = 0;
+ switch (colorMode) {
+ case splashModeRGB8:
+ case splashModeBGR8:
+ rgbCS = new GfxDeviceRGBColorSpace();
+ for (y = 0; y < h; ++y) {
+ for (comp = 0; comp < 4; ++comp) {
+ if (useBinary) {
+ // Binary color image
+ for (x = 0; x < w; ++x) {
+ if (likely(colorMode == splashModeRGB8)) {
+ inputColor.c[0] = byteToCol(p[3*x + 0]);
+ inputColor.c[1] = byteToCol(p[3*x + 1]);
+ inputColor.c[2] = byteToCol(p[3*x + 2]);
+ } else {
+ inputColor.c[0] = byteToCol(p[3*x + 2]);
+ inputColor.c[1] = byteToCol(p[3*x + 1]);
+ inputColor.c[2] = byteToCol(p[3*x + 0]);
+ }
+ rgbCS->getCMYK(&inputColor, &cmyk);
+ cmykColor[0] = colToByte(cmyk.c);
+ cmykColor[1] = colToByte(cmyk.m);
+ cmykColor[2] = colToByte(cmyk.y);
+ cmykColor[3] = colToByte(cmyk.k);
+
+ hexBuf[i++] = cmykColor[comp];
+ if (i >= 64) {
+ writePSBuf(hexBuf, i);
+ i = 0;
+ }
+ }
+ } else {
+ // Hex color image
+ for (x = 0; x < w; ++x) {
+ if (likely(colorMode == splashModeRGB8)) {
+ inputColor.c[0] = byteToCol(p[3*x + 0]);
+ inputColor.c[1] = byteToCol(p[3*x + 1]);
+ inputColor.c[2] = byteToCol(p[3*x + 2]);
+ } else {
+ inputColor.c[0] = byteToCol(p[3*x + 2]);
+ inputColor.c[1] = byteToCol(p[3*x + 1]);
+ inputColor.c[2] = byteToCol(p[3*x + 0]);
+ }
+ rgbCS->getCMYK(&inputColor, &cmyk);
+ cmykColor[0] = colToByte(cmyk.c);
+ cmykColor[1] = colToByte(cmyk.m);
+ cmykColor[2] = colToByte(cmyk.y);
+ cmykColor[3] = colToByte(cmyk.k);
+
+ digit = cmykColor[comp] / 16;
+ hexBuf[i++] = digit + ((digit >= 10)? 'a' - 10: '0');
+ digit = cmykColor[comp] % 16;
+ hexBuf[i++] = digit + ((digit >= 10)? 'a' - 10: '0');
+ if (i >= 64) {
+ hexBuf[i++] = '\n';
+ writePSBuf(hexBuf, i);
+ i = 0;
+ }
+ }
}
- }
- } else {
- // Hex color image
- for (x = 0; x < w; ++x) {
- digit = p[4*x + comp] / 16;
- hexBuf[i++] = digit + ((digit >= 10)? 'a' - 10: '0');
- digit = p[4*x + comp] % 16;
- hexBuf[i++] = digit + ((digit >= 10)? 'a' - 10: '0');
- if (i >= 64) {
- hexBuf[i++] = '\n';
- writePSBuf(hexBuf, i);
- i = 0;
+ }
+ p -= bitmap->getRowSize();
+ }
+ delete rgbCS;
+ break;
+ default:
+ for (y = 0; y < h; ++y) {
+ for (comp = 0; comp < 4; ++comp) {
+ if (useBinary) {
+ // Binary color image
+ for (x = 0; x < w; ++x) {
+ hexBuf[i++] = p[4*x + comp];
+ if (i >= 64) {
+ writePSBuf(hexBuf, i);
+ i = 0;
+ }
+ }
+ } else {
+ // Hex color image
+ for (x = 0; x < w; ++x) {
+ digit = p[4*x + comp] / 16;
+ hexBuf[i++] = digit + ((digit >= 10)? 'a' - 10: '0');
+ digit = p[4*x + comp] % 16;
+ hexBuf[i++] = digit + ((digit >= 10)? 'a' - 10: '0');
+ if (i >= 64) {
+ hexBuf[i++] = '\n';
+ writePSBuf(hexBuf, i);
+ i = 0;
+ }
+ }
}
- }
- }
- }
- p -= bitmap->getRowSize();
+ }
+ p -= bitmap->getRowSize();
+ }
+ break;
}
}
if (i != 0) {
--
2.21.0

View File

@ -0,0 +1,66 @@
From 25feab2736d35ca707bde173b4a7d548da342211 Mon Sep 17 00:00:00 2001
From: Marek Kasik <mkasik@redhat.com>
Date: Thu, 2 Jan 2020 13:40:40 +0100
Subject: [PATCH] Revert Remove unused MacroPushRequiredVars.cmake
This is needed by the QT4 removal revert.
---
cmake/modules/MacroPushRequiredVars.cmake | 46 +++++++++++++++++++++++
1 file changed, 46 insertions(+)
create mode 100644 cmake/modules/MacroPushRequiredVars.cmake
diff --git a/cmake/modules/MacroPushRequiredVars.cmake b/cmake/modules/MacroPushRequiredVars.cmake
new file mode 100644
index 00000000..35a6df5e
--- /dev/null
+++ b/cmake/modules/MacroPushRequiredVars.cmake
@@ -0,0 +1,46 @@
+# this module defines two macros:
+# MACRO_PUSH_REQUIRED_VARS()
+# and
+# MACRO_POP_REQUIRED_VARS()
+# use these if you call cmake macros which use
+# any of the CMAKE_REQUIRED_XXX variables
+#
+# Usage:
+# MACRO_PUSH_REQUIRED_VARS()
+# SET(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -DSOME_MORE_DEF)
+# CHECK_FUNCTION_EXISTS(...)
+# MACRO_POP_REQUIRED_VARS()
+
+# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+MACRO(MACRO_PUSH_REQUIRED_VARS)
+
+ IF(NOT DEFINED _PUSH_REQUIRED_VARS_COUNTER)
+ SET(_PUSH_REQUIRED_VARS_COUNTER 0)
+ ENDIF(NOT DEFINED _PUSH_REQUIRED_VARS_COUNTER)
+
+ MATH(EXPR _PUSH_REQUIRED_VARS_COUNTER "${_PUSH_REQUIRED_VARS_COUNTER}+1")
+
+ SET(_CMAKE_REQUIRED_INCLUDES_SAVE_${_PUSH_REQUIRED_VARS_COUNTER} ${CMAKE_REQUIRED_INCLUDES})
+ SET(_CMAKE_REQUIRED_DEFINITIONS_SAVE_${_PUSH_REQUIRED_VARS_COUNTER} ${CMAKE_REQUIRED_DEFINITIONS})
+ SET(_CMAKE_REQUIRED_LIBRARIES_SAVE_${_PUSH_REQUIRED_VARS_COUNTER} ${CMAKE_REQUIRED_LIBRARIES})
+ SET(_CMAKE_REQUIRED_FLAGS_SAVE_${_PUSH_REQUIRED_VARS_COUNTER} ${CMAKE_REQUIRED_FLAGS})
+ENDMACRO(MACRO_PUSH_REQUIRED_VARS)
+
+MACRO(MACRO_POP_REQUIRED_VARS)
+
+# don't pop more than we pushed
+ IF("${_PUSH_REQUIRED_VARS_COUNTER}" GREATER "0")
+
+ SET(CMAKE_REQUIRED_INCLUDES ${_CMAKE_REQUIRED_INCLUDES_SAVE_${_PUSH_REQUIRED_VARS_COUNTER}})
+ SET(CMAKE_REQUIRED_DEFINITIONS ${_CMAKE_REQUIRED_DEFINITIONS_SAVE_${_PUSH_REQUIRED_VARS_COUNTER}})
+ SET(CMAKE_REQUIRED_LIBRARIES ${_CMAKE_REQUIRED_LIBRARIES_SAVE_${_PUSH_REQUIRED_VARS_COUNTER}})
+ SET(CMAKE_REQUIRED_FLAGS ${_CMAKE_REQUIRED_FLAGS_SAVE_${_PUSH_REQUIRED_VARS_COUNTER}})
+
+ MATH(EXPR _PUSH_REQUIRED_VARS_COUNTER "${_PUSH_REQUIRED_VARS_COUNTER}-1")
+ ENDIF("${_PUSH_REQUIRED_VARS_COUNTER}" GREATER "0")
+
+ENDMACRO(MACRO_POP_REQUIRED_VARS)
--
2.24.1

View File

@ -0,0 +1,12 @@
--- poppler-0.90.0/CMakeLists.txt
+++ poppler-0.90.0/CMakeLists.txt
@@ -17,6 +17,9 @@ else()
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_package(Threads)
endif()
+
+set(CMAKE_POSITION_INDEPENDENT_CODE ON)
+
include(TestBigEndian)
test_big_endian(WORDS_BIGENDIAN)
include(CheckFileOffsetBits)

BIN
poppler-0.90.0.tar.xz Normal file

Binary file not shown.

View File

@ -1,62 +0,0 @@
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
---
diff --git a/glib/poppler-attachment.cc b/glib/poppler-attachment.cc
index c6502e9..d12833b 100644
--- a/glib/poppler-attachment.cc
+++ b/glib/poppler-attachment.cc
@@ -111,18 +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->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 != NULL && embFile->streamObject()->isStream())
+ {
+ attachment->size = embFile->size ();
- 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->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();
+ }
+ 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 b343eb9..df0aa47 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);
}

26
poppler-gcc11.patch Normal file
View File

@ -0,0 +1,26 @@
diff --git a/glib/poppler-enums.c.template b/glib/poppler-enums.c.template
index 26a51b4..27be2b9 100644
--- a/glib/poppler-enums.c.template
+++ b/glib/poppler-enums.c.template
@@ -15,7 +15,7 @@
GType
@enum_name@_get_type (void)
{
- static volatile gsize g_define_type_id__volatile = 0;
+ static gsize g_define_type_id__volatile = 0;
if (g_once_init_enter (&g_define_type_id__volatile)) {
static const G@Type@Value values[] = {
diff --git a/glib/poppler-private.h b/glib/poppler-private.h
index 7726ec7..436bca5 100644
--- a/glib/poppler-private.h
+++ b/glib/poppler-private.h
@@ -167,7 +167,7 @@ gboolean _poppler_convert_pdf_date_to_gtime (const GooString *date,
GType \
type_name##_get_type (void) \
{ \
- static volatile gsize g_define_type_id__volatile = 0; \
+ static gsize g_define_type_id__volatile = 0; \
if (g_once_init_enter (&g_define_type_id__volatile)) { \
GType g_define_type_id = \
g_boxed_type_register_static (g_intern_static_string (#TypeName), \

View File

@ -1,153 +1,135 @@
%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: 8
Summary: Poppler is a PDF rendering library based on the xpdf-3.0 code base
Version: 0.90.0
Release: 1
License: (GPLv2 or GPLv3) and GPLv2+ and LGPLv2+ and MIT
URL: https://poppler.freedesktop.org/
Source0: https://poppler.freedesktop.org/poppler-%{version}.tar.xz
Source1: %{name}-test-%{test_date}_%{test_sha}.tar.xz
# https://bugzilla.redhat.com/show_bug.cgi?id=1185007
URL: http://poppler.freedesktop.org/
Source0: http://poppler.freedesktop.org/poppler-%{version}.tar.xz
Source1: %{name}-test-%{test_date}-%{test_sha}.tar.xz
Patch0: poppler-0.30.0-rotated-words-selection.patch
Patch1: 0001-Revert-Remove-the-Qt4-frontend.patch
Patch4: poppler-0.63.0-python3.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1557355
Patch6: poppler-0.63.0-tiling-patterns.patch
Patch7: poppler-0.67.0-qt4-const.patch
Patch6000: poppler-CVE-2018-19149.patch
Patch6001: poppler_0.26.5_CVE-2019-9200.patch
Patch6002: CVE-2018-20662-1.patch
Patch6003: CVE-2018-20662-2.patch
Patch6004: CVE-2019-9903.patch
Patch6005: CVE-2019-9631-1.patch
Patch6006: CVE-2019-9631-2.patch
Patch6007: CVE-2019-9959.patch
Patch6008: CVE-2019-11026.patch
Patch6009: CVE-2018-19058.patch
Patch6010: CVE-2018-19059.patch
Patch6011: CVE-2018-20650.patch
Patch6012: CVE-2019-10872.patch
Patch6013: backport-CVE-2018-16646.patch
Patch6014: backport-CVE-2018-18897.patch
Patch6015: backport-CVE-2018-19060.patch
Patch6016: backport-CVE-2018-20481.patch
Patch6017: backport-CVE-2019-14494.patch
Patch6018: backport-CVE-2019-7310.patch
BuildRequires: cmake gcc-c++ gettext-devel qt5-qtbase-devel qt-devel cairo-devel fontconfig-devel
BuildRequires: freetype-devel gdk-pixbuf2-devel glib2-devel gobject-introspection-devel gtk3-devel
BuildRequires: gtk-doc lcms2-devel libjpeg-turbo-devel openjpeg2-devel libpng-devel libtiff-devel
BuildRequires: nss-devel poppler-data-devel
Patch4: poppler-0.73.0-PSOutputDev-buffer-read.patch
Patch5: poppler-0.84.0-MacroPushRequiredVars.patch
Patch7: poppler-0.90.0-position-independent-code.patch
Patch8: %{name}-gcc11.patch
BuildRequires: cmake
BuildRequires: gcc-c++
BuildRequires: gettext-devel
BuildRequires: pkgconfig(cairo)
BuildRequires: pkgconfig(cairo-ft)
BuildRequires: pkgconfig(cairo-pdf)
BuildRequires: pkgconfig(cairo-ps)
BuildRequires: pkgconfig(cairo-svg)
BuildRequires: pkgconfig(fontconfig)
BuildRequires: pkgconfig(freetype2)
BuildRequires: pkgconfig(gdk-pixbuf-2.0)
BuildRequires: pkgconfig(gio-2.0)
BuildRequires: pkgconfig(gobject-2.0)
BuildRequires: pkgconfig(gobject-introspection-1.0)
BuildRequires: pkgconfig(gtk+-3.0)
BuildRequires: pkgconfig(gtk-doc)
BuildRequires: pkgconfig(lcms2)
BuildRequires: pkgconfig(libjpeg)
BuildRequires: pkgconfig(libopenjp2)
BuildRequires: pkgconfig(libpng)
BuildRequires: pkgconfig(libtiff-4)
BuildRequires: pkgconfig(nss)
BuildRequires: pkgconfig(poppler-data)
BuildRequires: pkgconfig(Qt5Core)
BuildRequires: pkgconfig(Qt5Gui)
BuildRequires: pkgconfig(Qt5Test)
BuildRequires: pkgconfig(Qt5Widgets)
BuildRequires: pkgconfig(Qt5Xml)
Requires: poppler-data
Obsoletes: poppler-glib-demos < 0.60.1-1
Provides: poppler-utils
Obsoletes: poppler-utils
%description
Poppler is a free software utility library for rendering Portable Document Format (PDF) documents. \
Its development is supported by freedesktop.org. It is commonly used on Linux systems,and is used by \
the PDF viewers of the open source GNOME and KDE desktop environments.
%{name} is a PDF rendering library.
%package devel
Summary: Provide header files and libraries for poppler
Summary: Libraries and headers for poppler
Requires: %{name} = %{version}-%{release}
%description devel
The package provides necessary files and documents for the use of compiling applications based on poppler
You should install the poppler-devel package if you would like to
compile applications based on poppler.
%package glib
Summary: Provide glib wrapper for poppler
Summary: Glib wrapper for poppler
Requires: %{name} = %{version}-%{release}
%description glib
This package provides glib wrapper for poppler
%{summary}.
%package glib-devel
Summary: Provide development files for glib wrapper
Summary: Development files for glib wrapper
Requires: %{name}-glib = %{version}-%{release}
Requires: %{name}-devel = %{version}-%{release}
Suggests: %{name}-doc = %{version}-%{release}
%description glib-devel
This package provides development files for glib wrapper
%{summary}.
%package glib-doc
Summary: Provide documentation for glib wrapper
Summary: Documentation for glib wrapper
BuildArch: noarch
%description glib-doc
This package provides documentation files for glib wrapper
%package qt
Summary: Provides Qt4 wrapper for poppler
Requires: %{name} = %{version}-%{release}
%{?_qt4:Requires: qt4 >= %{_qt4_version}}
Obsoletes: poppler-qt4 < 0.16.0-3
Provides: poppler-qt4 = %{version}-%{release}
%description qt
This package provides Qt4 wrapper for poppler.
%package qt-devel
Summary: Provides development files for Qt4 wrapper
Requires: %{name}-qt = %{version}-%{release}
Requires: %{name}-devel = %{version}-%{release}
Obsoletes: poppler-qt4-devel < 0.16.0-3
Provides: poppler-qt4-devel = %{version}-%{release}
Requires: qt4-devel
%description qt-devel
This package provides development files for Qt4 wrapper.
%{summary}.
%package qt5
Summary: Provides Qt5 wrapper for poppler
Summary: Qt5 wrapper for poppler
Requires: %{name} = %{version}-%{release}
%description qt5
This package provides Qt5 wrapper for poppler.
%{summary}.
%package qt5-devel
Summary: Provides development files for Qt5 wrapper
Summary: Development files for Qt5 wrapper
Requires: %{name}-qt5 = %{version}-%{release}
Requires: %{name}-devel = %{version}-%{release}
Requires: qt5-qtbase-devel
%description qt5-devel
This package provides development files for Qt5 wrapper.
%{summary}.
%package cpp
Summary: Provide pure C++ wrapper for poppler
Summary: Pure C++ wrapper for poppler
Requires: %{name} = %{version}-%{release}
%description cpp
This package provides pure C++ wrapper for poppler
%{summary}.
%package cpp-devel
Summary: Provide development files for C++ wrapper
Summary: Development files for C++ wrapper
Requires: %{name}-cpp = %{version}-%{release}
Requires: %{name}-devel = %{version}-%{release}
%description cpp-devel
This package provides development files for C++ wrapper
%{summary}.
%package_help
%package utils
Summary: Command line utilities for converting PDF files
Requires: %{name} = %{version}-%{release}
%description utils
Command line tools for manipulating PDF files and converting them to
other formats.
%prep
%autosetup -n %{name}-%{version} -p1
%autosetup -p1 -b 1
%build
mkdir build
cd build
export CC="gcc -fPIC"
%cmake \
-DENABLE_CMS=lcms2 -DENABLE_DCTDECODER=libjpeg -DENABLE_GTK_DOC=ON \
-DENABLE_LIBOPENJPEG=openjpeg2 -DENABLE_XPDF_HEADERS=ON -DENABLE_ZLIB=OFF \
-DENABLE_CMS=lcms2 \
-DENABLE_DCTDECODER=libjpeg \
-DENABLE_GTK_DOC=ON \
-DENABLE_LIBOPENJPEG=openjpeg2 \
-DENABLE_UNSTABLE_API_ABI_HEADERS=ON \
-DENABLE_ZLIB=OFF \
..
unset CC
%make_build
%install
@ -155,49 +137,40 @@ unset CC
%check
%make_build test
export PKG_CONFIG_PATH=%{buildroot}%{_datadir}/pkgconfig:%{buildroot}%{_libdir}/pkgconfig
test "$(pkg-config --modversion poppler)" = "%{version}"
#test "$(pkg-config --modversion poppler)" = "%{version}"
test "$(pkg-config --modversion poppler-cairo)" = "%{version}"
test "$(pkg-config --modversion poppler-cpp)" = "%{version}"
test "$(pkg-config --modversion poppler-glib)" = "%{version}"
test "$(pkg-config --modversion poppler-qt4)" = "%{version}"
test "$(pkg-config --modversion poppler-qt5)" = "%{version}"
test "$(pkg-config --modversion poppler-splash)" = "%{version}"
%ldconfig_scriptlets
%ldconfig_scriptlets glib
%ldconfig_scriptlets qt
%ldconfig_scriptlets qt5
%ldconfig_scriptlets cpp
%files
%defattr(-,root,root)
%doc README.md
%license COPYING
%{_bindir}/pdf*
%{_libdir}/libpoppler.so.78*
%{_libdir}/libpoppler.so.101*
%files devel
%defattr(-,root,root)
%{_libdir}/pkgconfig/poppler.pc
%{_libdir}/pkgconfig/poppler-splash.pc
%{_libdir}/libpoppler.so
%dir %{_includedir}/poppler/
# xpdf headers
%{_includedir}/poppler/*.h
%{_includedir}/poppler/fofi/
%{_includedir}/poppler/goo/
%{_includedir}/poppler/splash/
%{_libdir}/pkgconfig/poppler.pc
%{_libdir}/pkgconfig/poppler-splash.pc
%{_libdir}/libpoppler.so
%files glib
%defattr(-,root,root)
%{_libdir}/libpoppler-glib.so.8*
%{_libdir}/girepository-1.0/Poppler-0.18.typelib
%files glib-devel
%defattr(-,root,root)
%{_libdir}/pkgconfig/poppler-glib.pc
%{_libdir}/pkgconfig/poppler-cairo.pc
%{_libdir}/libpoppler-glib.so
@ -205,45 +178,33 @@ test "$(pkg-config --modversion poppler-splash)" = "%{version}"
%{_includedir}/poppler/glib/
%files glib-doc
%defattr(-,root,root)
%license COPYING
%{_datadir}/gtk-doc/
%files qt
%defattr(-,root,root)
%{_libdir}/libpoppler-qt4.so.4*
%files qt-devel
%defattr(-,root,root)
%{_libdir}/libpoppler-qt4.so
%{_libdir}/pkgconfig/poppler-qt4.pc
%{_includedir}/poppler/qt4/
%files qt5
%defattr(-,root,root)
%{_libdir}/libpoppler-qt5.so.1*
%files qt5-devel
%defattr(-,root,root)
%{_libdir}/libpoppler-qt5.so
%{_libdir}/pkgconfig/poppler-qt5.pc
%{_includedir}/poppler/qt5/
%files cpp
%defattr(-,root,root)
%{_libdir}/libpoppler-cpp.so.0*
%files cpp-devel
%defattr(-,root,root)
%{_libdir}/pkgconfig/poppler-cpp.pc
%{_libdir}/libpoppler-cpp.so
%{_includedir}/poppler/cpp
%files help
%defattr(-,root,root)
%doc README
%files utils
%{_bindir}/pdf*
%{_mandir}/man1/*
%changelog
* Tue Aug 24 2021 chenchen <chen_aka_jan@163.com> - 0.90.0-1
- update to 0.90.0
* Fri Jul 30 2021 chenyanpanHW <chenyanpan@huawei.com> - 0.67.0-8
- DESC: delete -S git from %autosetup, and delete BuildRequires git

View File

@ -1,13 +0,0 @@
diff -Nur poppler-0.67.0-bak/poppler/Stream.cc poppler-0.67.0/poppler/Stream.cc
--- poppler-0.67.0-bak/poppler/Stream.cc 2019-04-17 18:06:23.521000000 +0800
+++ poppler-0.67.0/poppler/Stream.cc 2019-04-18 11:40:15.056000000 +0800
@@ -504,6 +504,9 @@
}
int readChars = str->doGetChars(inputLineSize, inputLine);
+ if (unlikely(readChars == -1)) {
+ readChars = 0;
+ }
for ( ; readChars < inputLineSize; readChars++) inputLine[readChars] = EOF;
if (nBits == 1) {
Guchar *p = inputLine;