poppler merge requestshttps://gitlab.freedesktop.org/poppler/poppler/-/merge_requests2024-03-26T23:48:29Zhttps://gitlab.freedesktop.org/poppler/poppler/-/merge_requests/1516qt6: Fix crash in SoundObject::data2024-03-26T23:48:29ZAlbert Astals Cidqt6: Fix crash in SoundObject::datahttps://gitlab.freedesktop.org/poppler/poppler/-/merge_requests/1186cairo: preserve text color when drawing type 3 glyphs2024-03-23T23:53:17ZAdrian Johnsoncairo: preserve text color when drawing type 3 glyphsType 3 glyphs (that don't override the color) should be painted with
the current graphics state color when the text operator is invoked.
Here are a couple of test cases I created with cairo user-fonts to test this fix.
Draw a single ty...Type 3 glyphs (that don't override the color) should be painted with
the current graphics state color when the text operator is invoked.
Here are a couple of test cases I created with cairo user-fonts to test this fix.
Draw a single type 3 glyph. Text color is green. The Type 3 glyph does not set the color. Without this fix CairoOuput draws the glyph all black.
[user-font.pdf](/uploads/9ff4bdec7d61764970517c48e56ff00d/user-font.pdf)
Draw a single type 3 color glyph. Text color is green. The Type 3 glyph draws one rectangle in the default color and one rectangle in red. Without this fix CairoOuput draws the default color rectangle in black.
[user-font-color.pdf](/uploads/9fbf43b09da782b1b0d42d38a5f29889/user-font-color.pdf)https://gitlab.freedesktop.org/poppler/poppler/-/merge_requests/1508CI: Switch debian to testing2024-03-04T23:39:45ZAlbert Astals CidCI: Switch debian to testingunstable is broken at the momentunstable is broken at the momenthttps://gitlab.freedesktop.org/poppler/poppler/-/merge_requests/1507Fix translations on non glibc platforms2024-03-01T10:07:19ZAlbert Astals CidFix translations on non glibc platformshttps://gitlab.freedesktop.org/poppler/poppler/-/merge_requests/1506Fix regression on encrypted files being repaired2024-02-22T08:15:38ZNelson Benítez LeónFix regression on encrypted files being repairedSome encrypted files which need repairing (see
links below) failed to open due to a regression
introduced in commit b3e86dbdba where an 'if
condition' was added that's hit by encrypted files
which need repairing.
The removal of this 'if...Some encrypted files which need repairing (see
links below) failed to open due to a regression
introduced in commit b3e86dbdba where an 'if
condition' was added that's hit by encrypted files
which need repairing.
The removal of this 'if condition' does not affect
the original buggy file that commit b3e86dbdba
targeted[1].
This commit also adds Qt5 and Qt6 tests for opening
an encrypted pdf file affected by this issue.
Fixes #1447 \
Fixes https://gitlab.gnome.org/GNOME/evince/-/issues/1889
Regression issue:\
https://bugs.freedesktop.org/show_bug.cgi?id=14303
[1] which can be found in this duplicate:\
https://bugs.freedesktop.org/show_bug.cgi?id=14399https://gitlab.freedesktop.org/poppler/poppler/-/merge_requests/1504Fix various issues related to https://bugs.chromium.org/p/oss-fuzz/issues/det...2024-02-20T23:42:25ZEven RouaultFix various issues related to https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=66523All those fixes contribue to avoid ``(ulimit -v 2000000; utils/pdftoppm clusterfuzz-testcase-minimized-gdal_filesystem_fuzzer-5567544853331968)`` to abort() or crash on nullptr dereference or integer overflow
[clusterfuzz-testcase-minim...All those fixes contribue to avoid ``(ulimit -v 2000000; utils/pdftoppm clusterfuzz-testcase-minimized-gdal_filesystem_fuzzer-5567544853331968)`` to abort() or crash on nullptr dereference or integer overflow
[clusterfuzz-testcase-minimized-gdal_filesystem_fuzzer-5567544853331968](/uploads/76cdb16098acc0f86ee5f330603b9849/clusterfuzz-testcase-minimized-gdal_filesystem_fuzzer-5567544853331968)https://gitlab.freedesktop.org/poppler/poppler/-/merge_requests/1505Fix read-heap-buffer-overflow in Splash::blitTransparent() in splashModeMono8...2024-02-20T21:59:37ZEven RouaultFix read-heap-buffer-overflow in Splash::blitTransparent() in splashModeMono8 caseFixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=64471
[clusterfuzz-testcase-minimized-gdal_fuzzer-6127122829410304](/uploads/698a0eb50ea5d3a75e98029d08b1b09c/clusterfuzz-testcase-minimized-gdal_fuzzer-6127122829410304)
```p...Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=64471
[clusterfuzz-testcase-minimized-gdal_fuzzer-6127122829410304](/uploads/698a0eb50ea5d3a75e98029d08b1b09c/clusterfuzz-testcase-minimized-gdal_fuzzer-6127122829410304)
```plaintext
$ utils/pdftoppm clusterfuzz-testcase-minimized-gdal_fuzzer-6127122829410304
[...]
=================================================================
==1758602==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x602000024cd5 at pc 0x7fd5850e977d bp 0x7ffe0e007430 sp 0x7ffe0e007428
READ of size 1 at 0x602000024cd5 thread T0
#0 0x7fd5850e977c in Splash::blitTransparent(SplashBitmap*, int, int, int, int, int, int) /home/even/poppler/splash/Splash.cc:5778:24
#1 0x7fd58505e19d in SplashOutputDev::beginTransparencyGroup(GfxState*, double const*, GfxColorSpace*, bool, bool, bool) /home/even/poppler/poppler/SplashOutputDev.cc:3998:17
#2 0x7fd5850451c3 in SplashOutputDev::setSoftMaskFromImageMask(GfxState*, Object*, Stream*, int, int, bool, bool, double*) /home/even/poppler/poppler/SplashOutputDev.cc:2692:5
#3 0x7fd584c3f6a7 in Gfx::doPatternImageMask(Object*, Stream*, int, int, bool, bool) /home/even/poppler/poppler/Gfx.cc:1964:10
#4 0x7fd584c5cc26 in Gfx::doImage(Object*, Stream*, bool) /home/even/poppler/poppler/Gfx.cc:4304:17
#5 0x7fd584c1827a in Gfx::opBeginImage(Object*, int) /home/even/poppler/poppler/Gfx.cc:4900:9
#6 0x7fd584c32abe in Gfx::execOp(Object*, Object*, int) /home/even/poppler/poppler/Gfx.cc:811:5
#7 0x7fd584c316ef in Gfx::go(bool) /home/even/poppler/poppler/Gfx.cc:686:13
#8 0x7fd584c30f76 in Gfx::display(Object*, bool) /home/even/poppler/poppler/Gfx.cc:647:5
#9 0x7fd58506713d in SplashOutputDev::tilingPatternFill(GfxState*, Gfx*, Catalog*, GfxTilingPattern*, double const*, int, int, int, int, double, double) /home/even/poppler/poppler/SplashOutputDev.cc:4424:10
#10 0x7fd584c3b41b in Gfx::doTilingPatternFill(GfxTilingPattern*, bool, bool, bool) /home/even/poppler/poppler/Gfx.cc:2176:53
#11 0x7fd584c36188 in Gfx::doPatternFill(bool) /home/even/poppler/poppler/Gfx.cc:1895:9
#12 0x7fd584c16d93 in Gfx::opFillStroke(Object*, int) /home/even/poppler/poppler/Gfx.cc:1794:17
#13 0x7fd584c32abe in Gfx::execOp(Object*, Object*, int) /home/even/poppler/poppler/Gfx.cc:811:5
#14 0x7fd584c316ef in Gfx::go(bool) /home/even/poppler/poppler/Gfx.cc:686:13
#15 0x7fd584c30f76 in Gfx::display(Object*, bool) /home/even/poppler/poppler/Gfx.cc:647:5
#16 0x7fd584de61b9 in Page::displaySlice(OutputDev*, double, double, int, bool, bool, int, int, int, int, bool, bool (*)(void*), void*, bool (*)(Annot*, void*), void*, bool) /home/even/poppler/poppler/Page.cc:593:14
#17 0x7fd584dfd5fc in PDFDoc::displayPageSlice(OutputDev*, int, double, double, int, bool, bool, bool, int, int, int, int, bool (*)(void*), void*, bool (*)(Annot*, void*), void*, bool) /home/even/poppler/poppler/PDFDoc.cc:633:24
#18 0x4cc9c6 in savePageSlice(PDFDoc*, SplashOutputDev*, int, int, int, int, int, double, double, char*) /home/even/poppler/utils/pdftoppm.cc:293:10
#19 0x4cb932 in main /home/even/poppler/utils/pdftoppm.cc:695:9
#20 0x7fd5841ef082 in __libc_start_main /build/glibc-wuryBv/glibc-2.31/csu/../csu/libc-start.c:308:16
#21 0x41d61d in _start (/home/even/poppler/build/utils/pdftoppm+0x41d61d)
0x602000024cd5 is located 1 bytes to the right of 4-byte region [0x602000024cd0,0x602000024cd4)
allocated by thread T0 here:
#0 0x495d5d in malloc (/home/even/poppler/build/utils/pdftoppm+0x495d5d)
#1 0x7fd5849f1d54 in gmalloc(unsigned long, bool) /home/even/poppler/goo/gmem.h:44:19
#2 0x7fd5849f0ed0 in gmallocn(int, int, bool) /home/even/poppler/goo/gmem.h:121:12
#3 0x7fd584c1384d in gmallocn_checkoverflow(int, int) /home/even/poppler/goo/gmem.h:126:12
#4 0x7fd5850f7ec5 in SplashBitmap::SplashBitmap(int, int, int, SplashColorMode, bool, bool, std::vector<GfxSeparationColorSpace*, std::allocator<GfxSeparationColorSpace*> > const*) /home/even/poppler/splash/SplashBitmap.cc:111:28
#5 0x7fd585066631 in SplashOutputDev::tilingPatternFill(GfxState*, Gfx*, Catalog*, GfxTilingPattern*, double const*, int, int, int, int, double, double) /home/even/poppler/poppler/SplashOutputDev.cc:4398:18
#6 0x7fd584c3b41b in Gfx::doTilingPatternFill(GfxTilingPattern*, bool, bool, bool) /home/even/poppler/poppler/Gfx.cc:2176:53
#7 0x7fd584c36188 in Gfx::doPatternFill(bool) /home/even/poppler/poppler/Gfx.cc:1895:9
#8 0x7fd584c16d93 in Gfx::opFillStroke(Object*, int) /home/even/poppler/poppler/Gfx.cc:1794:17
#9 0x7fd584c32abe in Gfx::execOp(Object*, Object*, int) /home/even/poppler/poppler/Gfx.cc:811:5
#10 0x7fd584c316ef in Gfx::go(bool) /home/even/poppler/poppler/Gfx.cc:686:13
#11 0x7fd584c30f76 in Gfx::display(Object*, bool) /home/even/poppler/poppler/Gfx.cc:647:5
#12 0x7fd584de61b9 in Page::displaySlice(OutputDev*, double, double, int, bool, bool, int, int, int, int, bool, bool (*)(void*), void*, bool (*)(Annot*, void*), void*, bool) /home/even/poppler/poppler/Page.cc:593:14
#13 0x7fd584dfd5fc in PDFDoc::displayPageSlice(OutputDev*, int, double, double, int, bool, bool, bool, int, int, int, int, bool (*)(void*), void*, bool (*)(Annot*, void*), void*, bool) /home/even/poppler/poppler/PDFDoc.cc:633:24
#14 0x4cc9c6 in savePageSlice(PDFDoc*, SplashOutputDev*, int, int, int, int, int, double, double, char*) /home/even/poppler/utils/pdftoppm.cc:293:10
#15 0x4cb932 in main /home/even/poppler/utils/pdftoppm.cc:695:9
#16 0x7fd5841ef082 in __libc_start_main /build/glibc-wuryBv/glibc-2.31/csu/../csu/libc-start.c:308:16
SUMMARY: AddressSanitizer: heap-buffer-overflow /home/even/poppler/splash/Splash.cc:5778:24 in Splash::blitTransparent(SplashBitmap*, int, int, int, int, int, int)
```https://gitlab.freedesktop.org/poppler/poppler/-/merge_requests/1241pdfsig: Sign form signature fields with an appearance2024-02-18T17:52:54ZErich Hooverpdfsig: Sign form signature fields with an appearanceThe last patch in this set adds support for pdfsig to add the "appearance" to a PDF document when signing an existing signature field, for example:
![image](/uploads/0bbe6f9d10fa85dc9fb5485fa095b3c9/image.png)
The patches leading up to ...The last patch in this set adds support for pdfsig to add the "appearance" to a PDF document when signing an existing signature field, for example:
![image](/uploads/0bbe6f9d10fa85dc9fb5485fa095b3c9/image.png)
The patches leading up to that fix various issues I encountered trying to do this:
* using a signature field that's not attached to a form (patches 1-3) [doing this to work around Issue #1280]
* obtaining the signer name when signing_cert is set and CMSSignerInfo is not (patch 4)https://gitlab.freedesktop.org/poppler/poppler/-/merge_requests/1502Enable pdfimages to print filenames to stdout.2024-02-15T22:27:15ZSebastian J. Bronnerwaschtl@sbronner.comEnable pdfimages to print filenames to stdout.Add a command line option -print-filenames so that after writing each
imaage to file, pdfimages will print the filename to stdout. This is in
line with the --batch-print option of scanimage and the stream_filelist
parameter of tesseract....Add a command line option -print-filenames so that after writing each
imaage to file, pdfimages will print the filename to stdout. This is in
line with the --batch-print option of scanimage and the stream_filelist
parameter of tesseract. It allows easy parallelization of different
stages of an image processing pipeline.https://gitlab.freedesktop.org/poppler/poppler/-/merge_requests/1498Gfx::doImage: skip drawing image when it has singular matrix2024-02-13T10:28:24ZNelson Benítez LeónGfx::doImage: skip drawing image when it has singular matrixotherwise it will result in broken output in Cairo backend.
Splash backend already works fine for this case because
it checks for singular matrix in `Splash::drawImage()`.
This commit adds that check early on in `Gfx::doImage()`
which ...otherwise it will result in broken output in Cairo backend.
Splash backend already works fine for this case because
it checks for singular matrix in `Splash::drawImage()`.
This commit adds that check early on in `Gfx::doImage()`
which fixes the Cairo backend and for Splash backend
means a perf improvement by avoiding lot of color
computation and image preparation done in
`SplashOutputDev::draw{Image,ImageMask,MaskedImage,softMaskedImage}`
functions prior to calling `Splash::drawImage` which is the one
that checks singular matrix and skips.
_Note:_ singular matrix case is not mentioned in PDF spec
but Xpdf and other pdf readers de-facto do as in here
i.e. skip drawing an image when it has a singular (non
invertible) matrix.
Fixes issue #1114https://gitlab.freedesktop.org/poppler/poppler/-/merge_requests/1495Fix directory traversal in pdfdetach2024-02-08T17:56:28ZAlbert Astals CidFix directory traversal in pdfdetachA carefully crafted pdf file could lead to writing files in wrong places
of the file system by using pdfdetach.
Thanks to jwilk for spotting the issue.
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1026908A carefully crafted pdf file could lead to writing files in wrong places
of the file system by using pdfdetach.
Thanks to jwilk for spotting the issue.
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1026908https://gitlab.freedesktop.org/poppler/poppler/-/merge_requests/1500Use an enum for Function getType2024-02-08T17:50:33ZAlbert Astals CidUse an enum for Function getTypehttps://gitlab.freedesktop.org/poppler/poppler/-/merge_requests/1494Use more vectors and less owning pointers + length2024-02-06T08:09:04ZSune VuorelaUse more vectors and less owning pointers + lengthAlso remove a couple of unreferenced functions.Also remove a couple of unreferenced functions.https://gitlab.freedesktop.org/poppler/poppler/-/merge_requests/1499Microoptimization in parsehex2024-02-06T00:18:11ZSune VuorelaMicrooptimization in parsehexparsehex is quite a hot codepath when loading documents.
Various experiments shown that this let the compiler generate slightly
faster code.parsehex is quite a hot codepath when loading documents.
Various experiments shown that this let the compiler generate slightly
faster code.https://gitlab.freedesktop.org/poppler/poppler/-/merge_requests/1493inline UnicodeIsValid2024-02-02T09:50:54ZSune Vuorelainline UnicodeIsValidWhile profiling document loading, a lot was hitting this function; try
let the compiler be smarter.While profiling document loading, a lot was hitting this function; try
let the compiler be smarter.https://gitlab.freedesktop.org/poppler/poppler/-/merge_requests/1435More unicode vectors; fewer raw pointers2024-02-01T23:15:52ZSune VuorelaMore unicode vectors; fewer raw pointersSlight cleanup of Unicode*,size to std::vector<Unicode>Slight cleanup of Unicode*,size to std::vector<Unicode>https://gitlab.freedesktop.org/poppler/poppler/-/merge_requests/1485Use FcPatternGetCharSet to fast skip fonts in findSystemFontFileForUChar2024-01-31T22:39:33ZKeyu TaoUse FcPatternGetCharSet to fast skip fonts in findSystemFontFileForUChar`HorizontalTextLayouter` checks fallback font for every character that `newFontNeeded` is true. It finally calls `GlobalParams::findSystemFontFileForUChar` to list available fonts and find the first font satisfying the `uChar`.
However, ...`HorizontalTextLayouter` checks fallback font for every character that `newFontNeeded` is true. It finally calls `GlobalParams::findSystemFontFileForUChar` to list available fonts and find the first font satisfying the `uChar`.
However, this is slow as `supportedFontForEmbedding()` needs to load and parse all fonts file until it finds the
appropriate one. To make things worse, poppler has to do this for **every single character** that default font
could not render.
I added `std::chrono::system_clock` inside `drawMultiLineText`.
On my laptop this following sentences (341 chars) requires 1.1s to render, with default font set as `Noto Sans`
(tested with Okular "inline note" mode):
```
噫吁嚱,危乎高哉,蜀道之难,难于上青天!蚕丛及鱼凫,开国何茫然。尔来四万八千岁,不与秦塞通人烟。西当太白有鸟道,可以横绝峨眉巅。地崩山摧壮士死,然后天梯石栈相钩连。上有六龙回日之高标,下有冲波逆折之回川。黄鹤之飞尚不得过,猿猱欲度愁攀援。青泥何盘盘,百步九折萦岩峦。扪参历井仰胁息,以手抚膺坐长叹。问君西游何时还,畏途巉岩不可攀。但见悲鸟号古木,雄飞雌从绕林间。又闻子规啼夜月,愁空山。蜀道之难难于上青天,使人听此凋朱颜。连峯去天不盈尺,枯松倒挂倚绝壁。飞湍瀑流争喧豗,砯厓转石万壑雷。其险也如此,嗟尔远道之人胡为乎来哉。剑阁峥嵘而崔嵬,一夫当关,万夫莫开。所守或匪亲,化为狼与豺。朝避猛虎,夕避长蛇。磨牙吮血,杀人如麻。锦城虽云乐,不如早还家。蜀道之难难于上青天,侧身西望长咨嗟。
```
This is slow as `findSystemFontFileForUChar` needs to load and parse 24 fonts for every character every time, thus
it needs about 3ms to render a single character. Setting default font to something like `Source Han Sans` workarounds
this bug, but:
- Distro/Software default font settings might set to a Latin font even when users work with their own languages.
- The Latin part of these fonts may be worse, and then users might not prefer to set them as default.
To avoid loading and parsing lots of fonts manually, this patch utilizes fontconfig API: it uses `FcCharSetHasChar()` to
make sure current font *could* handle current uChar, and then call `supportedFontForEmbedding()` to check if it
supports unicode bmp cmaps.
This is faster (though still have a lot of room for improvement) -- it takes 0.47s, a 2.3x performance improvement.
And also this helps add caching for `supportedFontForEmbedding` later as it only needs to check fonts that could really render
characters that we want.https://gitlab.freedesktop.org/poppler/poppler/-/merge_requests/1492Fix saving annotgeometry interior color when it's empty2024-01-26T17:27:58ZAlbert Astals CidFix saving annotgeometry interior color when it's emptyKDE bug #479732KDE bug #479732https://gitlab.freedesktop.org/poppler/poppler/-/merge_requests/1491Translate a comment that slipped in spanish2024-01-26T17:19:21ZNelson Benítez LeónTranslate a comment that slipped in spanishWhile browsing through the code I spotted this TODO comment in spanish.While browsing through the code I spotted this TODO comment in spanish.https://gitlab.freedesktop.org/poppler/poppler/-/merge_requests/1490Fix small oversight from b8de1a1912024-01-25T22:45:38ZNelson Benítez LeónFix small oversight from b8de1a191There was one 'bytecounter increase' case
that was not imported from the Xpdf code.
That caused some JPEG streams fail to
render when hitting that codepath, like
the file `p1.blank_with_poppler.pdf`
posted on issue #1319
Fixes #1319There was one 'bytecounter increase' case
that was not imported from the Xpdf code.
That caused some JPEG streams fail to
render when hitting that codepath, like
the file `p1.blank_with_poppler.pdf`
posted on issue #1319
Fixes #1319