poppler issueshttps://gitlab.freedesktop.org/poppler/poppler/-/issues2022-04-04T11:37:23Zhttps://gitlab.freedesktop.org/poppler/poppler/-/issues/729Emoji rendered as all black with Cairo backend2022-04-04T11:37:23ZEvadne WuEmoji rendered as all black with Cairo backendI have a particular file, as [attached](/uploads/745def5b4115b37960d24c7312b56cec/single-source.pdf), which is generated by entering an emoji in Google Doc, exporting it to PDF then cropping the page. It renders file in Acrobat and macOS...I have a particular file, as [attached](/uploads/745def5b4115b37960d24c7312b56cec/single-source.pdf), which is generated by entering an emoji in Google Doc, exporting it to PDF then cropping the page. It renders file in Acrobat and macOS Preview, but if I were to use `pdftocairo` this way:
pdftocairo input.pdf -pdf output.pdf
Then the output shows a black glyph instead of the intended colour glyph.
The same happens if I were to print to a Cairo context with `poppler_page_render_for_printing_with_options`, etc. So, I think the problem is within CairoFontEngine, possibly `_render_type3_glyph`?
This happens on Poppler 0.74 with Cairo 1.16, and I have verified that otherwise drawing emojis with PangoCairo works fine.https://gitlab.freedesktop.org/poppler/poppler/-/issues/728heap buffer overflow in ImageStream::getLine()2019-02-27T18:53:06ZLoginsoftheap buffer overflow in ImageStream::getLine()**What is vulnerability** - we discovered a heap buffer overflow at ImageStream::getLine() in Stream.cc in poppler 0.74.0.
**Command**- pdfimages -f 1 -l 1 -opw testing -upw testing -j -p -q $POC outputfile
**POC**- [REPRODUCER](https...**What is vulnerability** - we discovered a heap buffer overflow at ImageStream::getLine() in Stream.cc in poppler 0.74.0.
**Command**- pdfimages -f 1 -l 1 -opw testing -upw testing -j -p -q $POC outputfile
**POC**- [REPRODUCER](https://github.com/SegfaultMasters/covering360/blob/master/poppler/HB_POC?raw=true)
*This can be triggerd when compiled CFLAGS=”-fsanitize=address"
**Debug** -
**ASAN OUTPUT** -
~~~
=================================================================
==5771==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x603000010b3f at pc 0x7ffff67e3c20 bp 0x7fffffffa9d0 sp 0x7fffffffa9c0
WRITE of size 1 at 0x603000010b3f thread T0
#0 0x7ffff67e3c1f in ImageStream::getLine() /home/aceteam/Desktop/packages/poppler-master/poppler/Stream.cc:499
#1 0x55555556334a in ImageOutputDev::writeImageFile(ImgWriter*, ImageOutputDev::ImageFormat, char const*, Stream*, int, int, GfxImageColorMap*) /home/aceteam/Desktop/packages/poppler-master/utils/ImageOutputDev.cc:410
#2 0x555555565939 in ImageOutputDev::writeImage(GfxState*, Object*, Stream*, int, int, GfxImageColorMap*, bool) /home/aceteam/Desktop/packages/poppler-master/utils/ImageOutputDev.cc:666
#3 0x555555565b95 in ImageOutputDev::drawImage(GfxState*, Object*, Stream*, int, int, GfxImageColorMap*, bool, int*, bool) /home/aceteam/Desktop/packages/poppler-master/utils/ImageOutputDev.cc:702
#4 0x7ffff6667e1b in Gfx::doImage(Object*, Stream*, bool) /home/aceteam/Desktop/packages/poppler-master/poppler/Gfx.cc:4593
#5 0x7ffff666b5f9 in Gfx::opBeginImage(Object*, int) /home/aceteam/Desktop/packages/poppler-master/poppler/Gfx.cc:4897
#6 0x7ffff6636a48 in Gfx::execOp(Object*, Object*, int) /home/aceteam/Desktop/packages/poppler-master/poppler/Gfx.cc:876
#7 0x7ffff6635b3e in Gfx::go(bool) /home/aceteam/Desktop/packages/poppler-master/poppler/Gfx.cc:752
#8 0x7ffff6635590 in Gfx::display(Object*, bool) /home/aceteam/Desktop/packages/poppler-master/poppler/Gfx.cc:714
#9 0x7ffff666b09e in Gfx::drawForm(Object*, Dict*, double const*, double const*, bool, bool, GfxColorSpace*, bool, bool, bool, Function*, GfxColor*) /home/aceteam/Desktop/packages/poppler-master/poppler/Gfx.cc:4841
#10 0x7ffff6669ca4 in Gfx::doForm(Object*) /home/aceteam/Desktop/packages/poppler-master/poppler/Gfx.cc:4764
#11 0x7ffff6662f75 in Gfx::opXObject(Object*, int) /home/aceteam/Desktop/packages/poppler-master/poppler/Gfx.cc:4181
#12 0x7ffff6636a48 in Gfx::execOp(Object*, Object*, int) /home/aceteam/Desktop/packages/poppler-master/poppler/Gfx.cc:876
#13 0x7ffff6635b3e in Gfx::go(bool) /home/aceteam/Desktop/packages/poppler-master/poppler/Gfx.cc:752
#14 0x7ffff6635590 in Gfx::display(Object*, bool) /home/aceteam/Desktop/packages/poppler-master/poppler/Gfx.cc:714
#15 0x7ffff6762e8d in Page::displaySlice(OutputDev*, double, double, int, bool, bool, int, int, int, int, bool, bool (*)(void*), void*, bool (*)(Annot*, void*), void*, bool) /home/aceteam/Desktop/packages/poppler-master/poppler/Page.cc:548
#16 0x7ffff6762354 in Page::display(OutputDev*, double, double, int, bool, bool, bool, bool (*)(void*), void*, bool (*)(Annot*, void*), void*, bool) /home/aceteam/Desktop/packages/poppler-master/poppler/Page.cc:469
#17 0x7ffff676dac9 in PDFDoc::displayPage(OutputDev*, int, double, double, int, bool, bool, bool, bool (*)(void*), void*, bool (*)(Annot*, void*), void*, bool) /home/aceteam/Desktop/packages/poppler-master/poppler/PDFDoc.cc:633
#18 0x7ffff676db63 in PDFDoc::displayPages(OutputDev*, int, int, double, double, int, bool, bool, bool, bool (*)(void*), void*, bool (*)(Annot*, void*), void*) /home/aceteam/Desktop/packages/poppler-master/poppler/PDFDoc.cc:650
#19 0x555555560c93 in main /home/aceteam/Desktop/packages/poppler-master/utils/pdfimages.cc:220
#20 0x7ffff5abeb96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
#21 0x55555555f129 in _start (/usr/local/bin/pdfimages+0xb129)
0x603000010b3f is located 1 bytes to the left of 30-byte region [0x603000010b40,0x603000010b5e)
allocated by thread T0 here:
#0 0x7ffff6ef8b50 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb50)
#1 0x555555565ed4 in gmalloc(unsigned long, bool) /home/aceteam/Desktop/packages/poppler-master/goo/gmem.h:41
#2 0x5555555660f2 in gmallocn(int, int, bool) (/usr/local/bin/pdfimages+0x120f2)
#3 0x7ffff662f66b in gmallocn_checkoverflow(int, int) /home/aceteam/Desktop/packages/poppler-master/goo/gmem.h:119
#4 0x7ffff67e33a3 in ImageStream::ImageStream(Stream*, int, int, int) /home/aceteam/Desktop/packages/poppler-master/poppler/Stream.cc:446
#5 0x555555563175 in ImageOutputDev::writeImageFile(ImgWriter*, ImageOutputDev::ImageFormat, char const*, Stream*, int, int, GfxImageColorMap*) /home/aceteam/Desktop/packages/poppler-master/utils/ImageOutputDev.cc:381
#6 0x555555565939 in ImageOutputDev::writeImage(GfxState*, Object*, Stream*, int, int, GfxImageColorMap*, bool) /home/aceteam/Desktop/packages/poppler-master/utils/ImageOutputDev.cc:666
#7 0x555555565b95 in ImageOutputDev::drawImage(GfxState*, Object*, Stream*, int, int, GfxImageColorMap*, bool, int*, bool) /home/aceteam/Desktop/packages/poppler-master/utils/ImageOutputDev.cc:702
#8 0x7ffff6667e1b in Gfx::doImage(Object*, Stream*, bool) /home/aceteam/Desktop/packages/poppler-master/poppler/Gfx.cc:4593
#9 0x7ffff666b5f9 in Gfx::opBeginImage(Object*, int) /home/aceteam/Desktop/packages/poppler-master/poppler/Gfx.cc:4897
#10 0x7ffff6636a48 in Gfx::execOp(Object*, Object*, int) /home/aceteam/Desktop/packages/poppler-master/poppler/Gfx.cc:876
#11 0x7ffff6635b3e in Gfx::go(bool) /home/aceteam/Desktop/packages/poppler-master/poppler/Gfx.cc:752
#12 0x7ffff6635590 in Gfx::display(Object*, bool) /home/aceteam/Desktop/packages/poppler-master/poppler/Gfx.cc:714
#13 0x7ffff666b09e in Gfx::drawForm(Object*, Dict*, double const*, double const*, bool, bool, GfxColorSpace*, bool, bool, bool, Function*, GfxColor*) /home/aceteam/Desktop/packages/poppler-master/poppler/Gfx.cc:4841
#14 0x7ffff6669ca4 in Gfx::doForm(Object*) /home/aceteam/Desktop/packages/poppler-master/poppler/Gfx.cc:4764
#15 0x7ffff6662f75 in Gfx::opXObject(Object*, int) /home/aceteam/Desktop/packages/poppler-master/poppler/Gfx.cc:4181
#16 0x7ffff6636a48 in Gfx::execOp(Object*, Object*, int) /home/aceteam/Desktop/packages/poppler-master/poppler/Gfx.cc:876
#17 0x7ffff6635b3e in Gfx::go(bool) /home/aceteam/Desktop/packages/poppler-master/poppler/Gfx.cc:752
#18 0x7ffff6635590 in Gfx::display(Object*, bool) /home/aceteam/Desktop/packages/poppler-master/poppler/Gfx.cc:714
#19 0x7ffff6762e8d in Page::displaySlice(OutputDev*, double, double, int, bool, bool, int, int, int, int, bool, bool (*)(void*), void*, bool (*)(Annot*, void*), void*, bool) /home/aceteam/Desktop/packages/poppler-master/poppler/Page.cc:548
#20 0x7ffff6762354 in Page::display(OutputDev*, double, double, int, bool, bool, bool, bool (*)(void*), void*, bool (*)(Annot*, void*), void*, bool) /home/aceteam/Desktop/packages/poppler-master/poppler/Page.cc:469
#21 0x7ffff676dac9 in PDFDoc::displayPage(OutputDev*, int, double, double, int, bool, bool, bool, bool (*)(void*), void*, bool (*)(Annot*, void*), void*, bool) /home/aceteam/Desktop/packages/poppler-master/poppler/PDFDoc.cc:633
#22 0x7ffff676db63 in PDFDoc::displayPages(OutputDev*, int, int, double, double, int, bool, bool, bool, bool (*)(void*), void*, bool (*)(Annot*, void*), void*) /home/aceteam/Desktop/packages/poppler-master/poppler/PDFDoc.cc:650
#23 0x555555560c93 in main /home/aceteam/Desktop/packages/poppler-master/utils/pdfimages.cc:220
#24 0x7ffff5abeb96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
SUMMARY: AddressSanitizer: heap-buffer-overflow /home/aceteam/Desktop/packages/poppler-master/poppler/Stream.cc:499 in ImageStream::getLine()
Shadow bytes around the buggy address:
0x0c067fffa110: 00 fa fa fa 00 00 00 fa fa fa fd fd fd fa fa fa
0x0c067fffa120: 00 00 00 fa fa fa 00 00 00 fa fa fa fd fd fd fa
0x0c067fffa130: fa fa fd fd fd fa fa fa fd fd fd fd fa fa 00 00
0x0c067fffa140: 00 fa fa fa 00 00 00 fa fa fa 00 00 00 fa fa fa
0x0c067fffa150: 00 00 00 fa fa fa 00 00 00 fa fa fa fd fd fd fd
=>0x0c067fffa160: fa fa 00 00 00 fa fa[fa]00 00 00 06 fa fa fa fa
0x0c067fffa170: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c067fffa180: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c067fffa190: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c067fffa1a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c067fffa1b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
==5771==ABORTING
~~~
**GDB OUTPUT** -
~~~
for ( ; readChars < inputLineSize; readChars++) inputLine[readChars] = EOF;
[ Legend: Modified register | Code | Heap | Stack | String ]
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[ registers ]────
$rax : 0xffffffff → 0x0000000000000000
$rbx : 0x7fffffffac50 → 0x00007fffffffac90 → 0x000000000000000a
$rcx : 0x0
$rdx : 0x0
$rsp : 0x7fffffffa9e0 → 0x00007fffffffaa30 → 0x00007fffffffac80 → 0x00007fffffffad40 → 0x00007fffffffad90 → 0x00007fffffffc380 → 0x00007fffffffc3c0 → 0x00007fffffffc420
$rbp : 0x7fffffffaa30 → 0x00007fffffffac80 → 0x00007fffffffad40 → 0x00007fffffffad90 → 0x00007fffffffc380 → 0x00007fffffffc3c0 → 0x00007fffffffc420 → 0x00007fffffffc850
$rsi : 0x3
$rdi : 0x608000002120 → 0x00007ffff6d150a8 → 0x00007ffff67e8d36 → <EmbedStream::~EmbedStream()+0> push rbp
$rip : 0x7ffff67e3b77 → <ImageStream::getLine()+229> mov rax, QWORD PTR [rbp-0x48]
$r8 : 0x3
$r9 : 0x2
$r10 : 0x7fffffffa1d8 → 0x00007ffff7fa8000 → 0x00007ffff7fde000 → 0x00007ffff716a698 → 0x00007ffff6f09090 → repz ret
$r11 : 0x7fffffffa1d8 → 0x00007ffff7fa8000 → 0x00007ffff7fde000 → 0x00007ffff716a698 → 0x00007ffff6f09090 → repz ret
$r12 : 0xffffffff55a → 0x0000000000000000
$r13 : 0x7fffffffaad0 → 0x0000000041b58ab3
$r14 : 0x6060000019a0 → 0x0000608000002120 → 0x00007ffff6d150a8 → 0x00007ffff67e8d36 → <EmbedStream::~EmbedStream()+0> push rbp
$r15 : 0x3
$eflags: [ZERO carry PARITY adjust sign trap INTERRUPT direction overflow resume virtualx86 identification]
$ss: 0x002b $gs: 0x0000 $fs: 0x0000 $es: 0x0000 $cs: 0x0033 $ds: 0x0000
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[ stack ]────
0x00007fffffffa9e0│+0x00: 0x00007fffffffaa30 → 0x00007fffffffac80 → 0x00007fffffffad40 → 0x00007fffffffad90 → 0x00007fffffffc380 → 0x00007fffffffc3c0 → 0x00007fffffffc420 ← $rsp
0x00007fffffffa9e8│+0x08: 0x00006060000019a0 → 0x0000608000002120 → 0x00007ffff6d150a8 → 0x00007ffff67e8d36 → <EmbedStream::~EmbedStream()+0> push rbp
0x00007fffffffa9f0│+0x10: 0x00007fffffffffff
0x00007fffffffa9f8│+0x18: 0x0e8cb3deecb26000
0x00007fffffffaa00│+0x20: 0x00000008ffffae50 → 0x0000000000000000
0x00007fffffffaa08│+0x28: 0x0e8cb3deecb26000
0x00007fffffffaa10│+0x30: 0x00000ffffffff55a → 0x0000000000000000
0x00007fffffffaa18│+0x38: 0x00007fffffffac50 → 0x00007fffffffac90 → 0x000000000000000a
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[ code:i386:x86-64 ]────
0x7ffff67e3b68 <ImageStream::getLine()+214> sbb BYTE PTR [rcx-0x3076b73a], cl
0x7ffff67e3b6f <ImageStream::getLine()+221> call 0x7ffff64e7dd0 <_ZN6Stream10doGetCharsEiPh@plt>
0x7ffff67e3b74 <ImageStream::getLine()+226> mov DWORD PTR [rbp-0x40], eax
→ 0x7ffff67e3b77 <ImageStream::getLine()+229> mov rax, QWORD PTR [rbp-0x48]
0x7ffff67e3b7b <ImageStream::getLine()+233> add rax, 0x18
0x7ffff67e3b7f <ImageStream::getLine()+237> mov rdx, rax
0x7ffff67e3b82 <ImageStream::getLine()+240> mov rax, rdx
0x7ffff67e3b85 <ImageStream::getLine()+243> shr rax, 0x3
0x7ffff67e3b89 <ImageStream::getLine()+247> add rax, 0x7fff8000
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[ source:/home/aceteam/Desktop/packages/poppler-master/poppler/Stream.cc+499 ]────
494 if (unlikely(inputLine == nullptr)) {
495 return nullptr;
496 }
497
498 int readChars = str->doGetChars(inputLineSize, inputLine);
// readChars=-0x1
→ 499 for ( ; readChars < inputLineSize; readChars++) inputLine[readChars] = EOF;
500 if (nBits == 1) {
501 unsigned char *p = inputLine;
502 for (int i = 0; i < nVals; i += 8) {
503 const int c = *p++;
504 imgLine[i+0] = (unsigned char)((c >> 7) & 1);
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[ threads ]────
[#0] Id 1, Name: "pdfimages", stopped, reason: BREAKPOINT
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[ trace ]────
[#0] 0x7ffff67e3b77 → Name: ImageStream::getLine(this=0x6060000019a0)
[#1] 0x55555556334b → Name: ImageOutputDev::writeImageFile(this=0x60f000000040, writer=0x603000010b10, format=ImageOutputDev::imgRGB, ext=0x55555556b8c0 "ppm", str=0x608000002120, width=0xa, height=0xa, colorMap=0x7fffffffbe70)
[#2] 0x55555556593a → Name: ImageOutputDev::writeImage(this=0x60f000000040, state=0x618000002080, ref=0x0, str=0x608000002120, width=0xa, height=0xa, colorMap=0x7fffffffbe70, inlineImg=0x1)
[#3] 0x555555565b96 → Name: ImageOutputDev::drawImage(this=0x60f000000040, state=0x618000002080, ref=0x0, str=0x608000002120, width=0xa, height=0xa, colorMap=0x7fffffffbe70, interpolate=0x0, maskColors=0x0, inlineImg=0x1)
[#4] 0x7ffff6667e1c → Name: Gfx::doImage(this=0x612000000640, ref=0x0, str=0x608000002120, inlineImg=0x1)
[#5] 0x7ffff666b5fa → Name: Gfx::opBeginImage(this=0x612000000640, args=0x7fffffffc5e0, numArgs=0x0)
[#6] 0x7ffff6636a49 → Name: Gfx::execOp(this=0x612000000640, cmd=0x7fffffffc4e0, args=0x7fffffffc5e0, numArgs=0x0)
[#7] 0x7ffff6635b3f → Name: Gfx::go(this=0x612000000640, topLevel=0x0)
[#8] 0x7ffff6635591 → Name: Gfx::display(this=0x612000000640, obj=0x7fffffffd070, topLevel=0x0)
[#9] 0x7ffff666b09f → Name: Gfx::drawForm(this=0x612000000640, str=0x7fffffffd070, resDict=0x6080000019a0, matrix=0x7fffffffce70, bbox=0x7fffffffce30, transpGroup=0x1, softMask=0x0, blendingColorSpace=0x0, isolated=0x0, knockout=0x0, alpha=0x0, transferFunc=0x0, backdropColor=0x0)
────────────────────────────────────────────────────────
gef➤ p/d readChars
$21 = -1
~~~https://gitlab.freedesktop.org/poppler/poppler/-/issues/727Unicode BOM appearing in annotation comments, are completely broken2019-06-20T13:07:47ZMichael GrattonUnicode BOM appearing in annotation comments, are completely brokenI received a PDF with annotations from a third party, and the comments all contain the Unicode BOM (U+FEFF) and missing most of the text:
![Screenshot_from_2019-02-25_11-04-48](/uploads/b7e637062858c5c56b3ff8520159b1e2/Screenshot_from_2...I received a PDF with annotations from a third party, and the comments all contain the Unicode BOM (U+FEFF) and missing most of the text:
![Screenshot_from_2019-02-25_11-04-48](/uploads/b7e637062858c5c56b3ff8520159b1e2/Screenshot_from_2019-02-25_11-04-48.png)
I can't attach the PDF since it's confidential, sorry.https://gitlab.freedesktop.org/poppler/poppler/-/issues/725Syntax errors are output to the console2019-02-21T19:57:54ZNathanael NobletSyntax errors are output to the consoleI have a PDF (a few of them actually) that when pdftotext is used (or a program we wrote using the cpp interface). Outputs a series of errors to the console. Other programs don't just wondering if it is a fatal error or what's going on. ...I have a PDF (a few of them actually) that when pdftotext is used (or a program we wrote using the cpp interface). Outputs a series of errors to the console. Other programs don't just wondering if it is a fatal error or what's going on. For example, I get the following output with [CAV-2-FORMB.pdf](/uploads/49f19efa4c4f732efb306d58aa53c056/CAV-2-FORMB.pdf)
```
Syntax Error: Unknown font in field's DA string
Syntax Error: Missing 'Tf' operator in field's DA string
Syntax Error: Unknown font in field's DA string
Syntax Error: Missing 'Tf' operator in field's DA string
Syntax Error: Unknown font in field's DA string
Syntax Error: Missing 'Tf' operator in field's DA string
Syntax Error: Unknown font in field's DA string
Syntax Error: Missing 'Tf' operator in field's DA string
Syntax Error: Unknown font in field's DA string
Syntax Error: Missing 'Tf' operator in field's DA string
Syntax Error: Unknown font in field's DA string
Syntax Error: Missing 'Tf' operator in field's DA string
Syntax Error: Unknown font in field's DA string
Syntax Error: Missing 'Tf' operator in field's DA string
```
The reason I found this was we were hashing the contents of PDFs. At first by just hashing the whole document. However some documents our system sees are the same but are produced dynamically, thus the timestamp changes but nothing else does. So we wrote the following to hash only the contents. When we ran our tests we started seeing the output above and checked against pdftotext and friends.
I figured I would include our hashing code as well as I'm wondering if
a) its a reliable way to detect identical PDF documents or if different versions of poppler could conceivably provide slightly different output causing the hashes to change with poppler updates.
b) Are there better ways of hashing a document's content while ignoring the creation timestamps etc?
```
std::string hashContents(poppler::document *doc) {
char mdString[SHA_DIGEST_LENGTH * 2 + 1];
unsigned char md[SHA_DIGEST_LENGTH];
poppler::page *page;
poppler::ustring pageData;
poppler::byte_array arr;
int lastPage = doc->pages();
SHA256_CTX context;
if (!SHA256_Init(&context)) {
throw Php::Exception("Unable to initialize openssl context");
}
for (int x = 0; x < lastPage; x++) {
page = doc->create_page(x);
pageData = page->text(page->page_rect(poppler::media_box));
arr = pageData.to_utf8();
if (!SHA256_Update(&context, (unsigned char*)&arr[0], arr.size())) {
throw Php::Exception("Unable to initialize openssl context");
}
delete page;
}
if (!SHA256_Final(md,&context)) {
throw Php::Exception("Unable to initialize openssl context");
}
for (int i = 0; i < SHA_DIGEST_LENGTH; i++) {
sprintf(&mdString[i*2], "%02x", (unsigned int)md[i]);
}
return mdString;
}
```https://gitlab.freedesktop.org/poppler/poppler/-/issues/724ℕ copied as N2021-03-02T18:19:38ZGermán Poo-Caamañoℕ copied as NAs reported in https://gitlab.gnome.org/GNOME/evince/issues/1085
Let's consider the document [qq.pdf](/uploads/eaa215c261d6d469b23fd15cf86baec7/qq.pdf). It contains `ℕ` (U+2115) as reported by `pdftotext`. However, copying the symbol us...As reported in https://gitlab.gnome.org/GNOME/evince/issues/1085
Let's consider the document [qq.pdf](/uploads/eaa215c261d6d469b23fd15cf86baec7/qq.pdf). It contains `ℕ` (U+2115) as reported by `pdftotext`. However, copying the symbol using Ctrl+Ins and pasting it into `emacs` or `gedit` produces a plain N. Apparently, this does not happen with Foxit (cf. https://tex.stackexchange.com/questions/475585/ℕ-goes-as-n-into-the-text-layer), which copies the Unicode char ℕ. This bug (or feature, depending on your viewpoint) of `evince` is definitely worth being improved.
The issue is reproducible with Okular, Evince, also `poppler-glib-demo`.https://gitlab.freedesktop.org/poppler/poppler/-/issues/723Problem with Cyrillic encoding2019-02-18T20:25:33ZSergey PopovProblem with Cyrillic encodingHello, dear developers!
When using the library (poppler-0.74.0.tar.xz, poppler-data-0.4.9.tar.gz), there was a problem with Cyrillic encoding.
I start the conversion with the following command:
pdftohtml -c -fmt png -zoom 1.5 -enc Win...Hello, dear developers!
When using the library (poppler-0.74.0.tar.xz, poppler-data-0.4.9.tar.gz), there was a problem with Cyrillic encoding.
I start the conversion with the following command:
pdftohtml -c -fmt png -zoom 1.5 -enc Windows-1255 /home/vagrant/code/1.pdf /home/vagrant/code/1.html
As a result, I get html with incorrect encoding, I attach a screenshot of result.png![result](/uploads/81504de00a58968eb9fcbe183e5991b4/result.png)
This problem is observed only on some pdf files.
I can not attach the file myself, but I can give part of the title:
%PDF-1.3
%Є«¬
4 0 obj
<< /Type /Info
/Producer (FOP 0.20.5) >>
endobj
5 0 obj
<< /Length 2913 /Filter [ /ASCII85Decode /FlateDecode ]
>>
stre**am
.......
Possible problem in ASCII85Decode?
Dear developers, how can correctly decode these pdf files?
Thanks!https://gitlab.freedesktop.org/poppler/poppler/-/issues/717Heap buffer overflow in XRef::getEntry due to integer overflow2019-02-02T16:58:17ZMaksimHeap buffer overflow in XRef::getEntry due to integer overflowHey guys,
I recently found the following heap overflow in the pdftocairo:
```
/home/build/utils/pdftocairo -png issue7769.pdf_mutateds15AWHBEDIM0FJJSDG2HJSPL3612DRE
=================================================================
==422...Hey guys,
I recently found the following heap overflow in the pdftocairo:
```
/home/build/utils/pdftocairo -png issue7769.pdf_mutateds15AWHBEDIM0FJJSDG2HJSPL3612DRE
=================================================================
==42259==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x62e000000394 at pc 0x7fb786812fcc bp 0x7fff4da3fa20 sp 0x7fff4da3fa10
READ of size 4 at 0x62e000000394 thread T0
#0 0x7fb786812fcb in XRef::getEntry(int, bool) /home/poppler/poppler/XRef.cc:1553
#1 0x7fb7866b777e in Parser::makeStream(Object&&, unsigned char*, CryptAlgorithm, int, int, int, int, bool) /home/poppler/poppler/Parser.cc:204
#2 0x7fb7866bb47d in Parser::getObj(bool, unsigned char*, CryptAlgorithm, int, int, int, int, bool) /home/poppler/poppler/Parser.cc:134
#3 0x7fb78660dd74 in Hints::readTables(BaseStream*, Linearization*, XRef*, SecurityHandler*) /home/poppler/poppler/Hints.cc:211
#4 0x7fb7866c1956 in PDFDoc::checkLinearization() /home/poppler/poppler/PDFDoc.cc:702
#5 0x7fb7866ccce7 in PDFDoc::getPage(int) /home/poppler/poppler/PDFDoc.cc:2110
#6 0x40ff85 in PDFDoc::getPageMediaWidth(int) /home/poppler/poppler/PDFDoc.h:168
#7 0x40ff85 in main /home/poppler/utils/pdftocairo.cc:1215
#8 0x7fb7854ab82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
#9 0x413bb8 in _start (/home/build/utils/pdftocairo+0x413bb8)
0x62e000000394 is located 108 bytes to the left of 40960-byte region [0x62e000000400,0x62e00000a400)
allocated by thread T0 here:
#0 0x7fb7874fa602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
#1 0x7fb7868038a6 in grealloc(void*, unsigned long, bool) /home/poppler/goo/gmem.h:73
#2 0x7fb7868038a6 in greallocn(void*, int, int, bool) /home/poppler/goo/gmem.h:160
#3 0x7fb7868038a6 in greallocn_checkoverflow(void*, int, int) /home/poppler/goo/gmem.h:164
#4 0x7fb7868038a6 in XRef::reserve(int) /home/poppler/poppler/XRef.cc:400
SUMMARY: AddressSanitizer: heap-buffer-overflow /home/poppler/poppler/XRef.cc:1553 XRef::getEntry(int, bool)
Shadow bytes around the buggy address:
0x0c5c7fff8020: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c5c7fff8030: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c5c7fff8040: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c5c7fff8050: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c5c7fff8060: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x0c5c7fff8070: fa fa[fa]fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c5c7fff8080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c5c7fff8090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c5c7fff80a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c5c7fff80b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c5c7fff80c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Heap right redzone: fb
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack partial redzone: f4
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
==42259==ABORTING
```
Looks like, if variable ```i``` is negative it causes ```entries[i].type == xrefEntryNone``` be executed. You can find a reproducer in the attachment.
Thank you![issue7769.pdf_mutated](/uploads/767ef9c574b465d0dd0031bc6dbcb530/issue7769.pdf_mutated)https://gitlab.freedesktop.org/poppler/poppler/-/issues/713document.pdfConverter().convert() to pipe silently fails2019-04-17T12:20:53ZAndreas Gruenbacherdocument.pdfConverter().convert() to pipe silently failsI'm using the following snippet of code to write a Poppler document to a file descriptor:
```python
def write_pdf(fd, document):
converter = document.pdfConverter()
converter.setPDFOptions(converter.pdfOptions() | Poppler.PDFCon...I'm using the following snippet of code to write a Poppler document to a file descriptor:
```python
def write_pdf(fd, document):
converter = document.pdfConverter()
converter.setPDFOptions(converter.pdfOptions() | Poppler.PDFConverter.WithChanges)
qfile = QFile()
qfile.open(fd, QIODevice.WriteOnly)
converter.setOutputDevice(qfile)
if not converter.convert():
raise IOError(converter.lastError())
```
This is working fine when `fd` is a regular file, but when it is a pipe, *some* documents are corrupted when written to the pipe. My assumption is that Poppler tries to seek in the output file without checking the error code.
Assuming that Poppler actually needs to seek in the output file for some input files at least, I think it would also make sense to always check if the output file is seekable and to fail if it is not. Otherwise, programs using Poppler will appear to work fine when they are actually subtly broken.https://gitlab.freedesktop.org/poppler/poppler/-/issues/7100.72.0 build error -openjpeg2019-01-07T18:45:58Zlucidprogrammer0.72.0 build error -openjpegHow to fix this? Any suggestions?
CMake Error at /usr/lib/cmake/openjpeg-2.3/OpenJPEGTargets.cmake:76 (message):
The imported target "opj_decompress" references the file
"/usr/bin/opj_decompress"
but this file does not exist...How to fix this? Any suggestions?
CMake Error at /usr/lib/cmake/openjpeg-2.3/OpenJPEGTargets.cmake:76 (message):
The imported target "opj_decompress" references the file
"/usr/bin/opj_decompress"
but this file does not exist. Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
"/usr/lib/cmake/openjpeg-2.3/OpenJPEGTargets.cmake"
As of now, I am using -DENABLE_LIBOPENJPEG=unmaintainedhttps://gitlab.freedesktop.org/poppler/poppler/-/issues/709remove obsolete platform specific code2019-01-19T08:08:06ZChristian Perschremove obsolete platform specific codeThere are a few places (most importantly goo/gfile.cc, plus a few sprinkled here and there) where poppler has conditional code supporting VMS, OS/2+EMX, ACORN. All of these are obsolete, and have very likely nobody using poppler on them....There are a few places (most importantly goo/gfile.cc, plus a few sprinkled here and there) where poppler has conditional code supporting VMS, OS/2+EMX, ACORN. All of these are obsolete, and have very likely nobody using poppler on them. That means the code is untested (and likely incomplete), so I think poppler should remove these bits of code.https://gitlab.freedesktop.org/poppler/poppler/-/issues/706SIGABRT at poppler/Object.h:2582022-08-09T01:59:51ZhongxuSIGABRT at poppler/Object.h:258As of de0c0b83, when invoking `pdfunite TESTPDF POC OUTPUT.pdf`, it may crash with the following backtrace:
```
Program received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=0x6) at ../sysdeps/unix/sysv/linux/raise.c:51
51 .....As of de0c0b83, when invoking `pdfunite TESTPDF POC OUTPUT.pdf`, it may crash with the following backtrace:
```
Program received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=0x6) at ../sysdeps/unix/sysv/linux/raise.c:51
51 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
#0 __GI_raise (sig=sig@entry=0x6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1 0x00007ffff5f3a801 in __GI_abort () at abort.c:79
#2 0x000000000051e117 in Object::getDict (this=0x7fffffffbd70) at ../poppler/Object.h:258
#3 main (argc=<optimized out>, argv=<optimized out>) at ../utils/pdfunite.cc:205
```
[pdfunite.zip](/uploads/6b9f371709bfbb06a391d0f3d02c401b/pdfunite.zip)
2 `POC`s are attached inside the zip file; `TESTPDF` seems not important.https://gitlab.freedesktop.org/poppler/poppler/-/issues/704a reachable abort in FileSpec::FileSpec in FileSpec.cc2018-12-29T00:27:13Zskysidera reachable abort in FileSpec::FileSpec in FileSpec.ccVersion: latest compiled version from git repo
Command: `pdfdetach -save 1 abort2.pdf`
Backtrace:
```
Internal Error (0): Call to Object where the object was type 3, not the expected type 7
Breakpoint 2, __GI_abort () at abort.c:51
51...Version: latest compiled version from git repo
Command: `pdfdetach -save 1 abort2.pdf`
Backtrace:
```
Internal Error (0): Call to Object where the object was type 3, not the expected type 7
Breakpoint 2, __GI_abort () at abort.c:51
51 abort.c: No such file or directory.
(gdb) bt
#0 __GI_abort () at abort.c:51
#1 0x0814e543 in Object::dictLookup (key=0x8611060 "Desc", this=0xf3f02854, this=0xf3f02854, recursion=0) at /work/poppler/poppler/Object.h:369
#2 0x0814fab2 in FileSpec::FileSpec (this=0xf3f02850, fileSpecA=0xf5b06ef4) at /work/poppler/poppler/FileSpec.cc:138
#3 0x08115ac4 in main (argc=2, argv=0xffffd7a4) at /work/poppler/utils/pdfdetach.cc:180
(gdb) list FileSpec.cc:138
133 return;
134 }
135 }
136 }
137
138 obj1 = fileSpec.dictLookup("Desc");
139 if (obj1.isString())
140 desc = obj1.getString()->copy();
141 }
142
```
The pdf file is attached here. [reachabort2.pdf](/uploads/89b0d6bf44de7a83374c7aee71444b78/reachabort2.pdf)https://gitlab.freedesktop.org/poppler/poppler/-/issues/703a reachable abort in AnnotRichMedia::Content::Content at Annot.cc:64322018-12-27T16:36:52Zskysidera reachable abort in AnnotRichMedia::Content::Content at Annot.cc:6432I compiled latest poppler library and it aborted when I run `pdfdetach -save 1 abort.pdf`, this is the backtrace:
```
Syntax Error: End of file inside array
Syntax Error: End of file inside dictionary
Internal Error (0): Call to Object w...I compiled latest poppler library and it aborted when I run `pdfdetach -save 1 abort.pdf`, this is the backtrace:
```
Syntax Error: End of file inside array
Syntax Error: End of file inside dictionary
Internal Error (0): Call to Object where the object was type 1, not the expected type 3
Breakpoint 2, __GI_abort () at abort.c:51
51 abort.c: No such file or directory.
(gdb) bt
#0 __GI_abort () at abort.c:51
#1 0x084d4b93 in Object::getString (this=0xffffcde0, this=0xffffcde0) at /work/poppler/poppler/Object.h:253
#2 0x084fb2d2 in AnnotRichMedia::Content::Content (this=0xf5d1f5b0, dict=0xf3f001d0) at /work/poppler/poppler/Annot.cc:6432
#3 0x0854b0df in std::make_unique<AnnotRichMedia::Content, Dict*>(Dict*&&) () at /usr/include/c++/5/bits/unique_ptr.h:765
#4 0x084fbae1 in AnnotRichMedia::initialize (this=0xf3502ea0, docA=0xf3902b90, dict=0xf3f002d0) at /work/poppler/poppler/Annot.cc:6310
#5 0x0852928d in Annots::createAnnot(Object&&, Object const*) (this=0xf5d1e970,
dictObject=<unknown type in /work/poppler/build/utils/pdfdetach, CU 0x469504, DIE 0x4d8d15>, obj=0xffffd0e0)
at /work/poppler/poppler/Annot.cc:6747
#6 0x08535fb3 in Annots::Annots (this=0xf5d1e970, docA=0xf3902b90, page=1, annotsObj=0xffffd180) at /work/poppler/poppler/Annot.cc:6648
#7 0x083089b8 in Page::getAnnots (this=0xf3302dc0, xrefA=0x0) at /work/poppler/poppler/Page.cc:362
#8 0x081158fa in main (argc=2, argv=0xffffd7a4) at /work/poppler/utils/pdfdetach.cc:172
(gdb) list Annot.cc:6432
6427 assets[counter] = new AnnotRichMedia::Asset;
6428
6429 Object objKey = obj2.arrayGet(i * 2);
6430 assets[counter]->fileSpec = obj2.arrayGet(i * 2 + 1);
6431
6432 assets[counter]->name = std::make_unique<GooString>( objKey.getString() );
6433 ++counter;
6434
6435 }
6436 }
```
the file is attached here [reachabort.pdf](/uploads/3531ea6675c1a937b5ce70f2a00ef84d/reachabort.pdf)https://gitlab.freedesktop.org/poppler/poppler/-/issues/702Image extraction results in negative(inverted) jpeg images2018-12-24T02:05:00ZPavel K.Image extraction results in negative(inverted) jpeg imagesExtracting images with v0.72.0 on attached pdf file results in jpg images being inverted.
pdfimages -j -png -p neg.pdf test/image
[neg.pdf](/uploads/be4b26f0499cdbefed8c0114ce910b8b/neg.pdf)
Additional note is that if -j flag is not u...Extracting images with v0.72.0 on attached pdf file results in jpg images being inverted.
pdfimages -j -png -p neg.pdf test/image
[neg.pdf](/uploads/be4b26f0499cdbefed8c0114ce910b8b/neg.pdf)
Additional note is that if -j flag is not used, extracted png images are all fine.https://gitlab.freedesktop.org/poppler/poppler/-/issues/695File crashes in ArthurOutputDev::stroke2020-03-26T21:44:21ZAlbert Astals CidFile crashes in ArthurOutputDev::strokeWhen rendering with arthur i get a crash in this file https://bugs.kde.org/attachment.cgi?id=13823
```
#0 0x00007ffff7c638ae in ?? () from /usr/lib/libQt5Gui.so.5
#1 0x00007ffff7c69ebb in ?? () from /usr/lib/libQt5Gui.so.5
#2 0x00007...When rendering with arthur i get a crash in this file https://bugs.kde.org/attachment.cgi?id=13823
```
#0 0x00007ffff7c638ae in ?? () from /usr/lib/libQt5Gui.so.5
#1 0x00007ffff7c69ebb in ?? () from /usr/lib/libQt5Gui.so.5
#2 0x00007ffff7cd5e17 in QRasterPaintEngine::stroke(QVectorPath const&, QPen const&) () from /usr/lib/libQt5Gui.so.5
#3 0x00007ffff7ce6815 in QPainter::strokePath(QPainterPath const&, QPen const&) () from /usr/lib/libQt5Gui.so.5
#4 0x00007ffff7fabe55 in ArthurOutputDev::stroke (this=0x7fffe77fd650, state=<optimized out>) at /home/tsdgeos/devel/poppler/poppler/GfxState.h:1508
#5 0x00007ffff6f1de36 in Gfx::opStroke (this=0x7fffd800d350, args=<optimized out>, numArgs=<optimized out>) at /home/tsdgeos/devel/poppler/poppler/Gfx.cc:1774
#6 0x00007ffff6f1a75f in Gfx::go (this=this@entry=0x7fffd800d350, topLevel=topLevel@entry=false) at /home/tsdgeos/devel/poppler/poppler/Gfx.cc:752
#7 0x00007ffff6f1ab4f in Gfx::display (this=this@entry=0x7fffd800d350, obj=obj@entry=0x7fffd803f2b8, topLevel=topLevel@entry=false) at /home/tsdgeos/devel/poppler/poppler/Gfx.cc:714
#8 0x00007ffff6f1afcc in Gfx::drawForm (this=0x7fffd800d350, str=0x7fffd803f2b8, resDict=<optimized out>, matrix=<optimized out>, bbox=0x7fffd803f248, transpGroup=<optimized out>, softMask=false, blendingColorSpace=0x0, isolated=false, knockout=false, alpha=false,
transferFunc=0x0, backdropColor=0x0) at /home/tsdgeos/devel/poppler/poppler/Gfx.cc:4841
#9 0x00007ffff6f1d93d in Gfx::doTilingPatternFill (this=0x7fffd800d350, tPat=0x7fffd803f230, stroke=<optimized out>, eoFill=<optimized out>, text=<optimized out>) at /home/tsdgeos/devel/poppler/poppler/GfxState.h:807
#10 0x00007ffff6f1dc7a in Gfx::opFill (this=0x7fffd800d350, args=<optimized out>, numArgs=<optimized out>) at /home/tsdgeos/devel/poppler/poppler/Gfx.cc:1809
#11 0x00007ffff6f1a75f in Gfx::go (this=this@entry=0x7fffd800d350, topLevel=topLevel@entry=true) at /home/tsdgeos/devel/poppler/poppler/Gfx.cc:752
#12 0x00007ffff6f1ab4f in Gfx::display (this=this@entry=0x7fffd800d350, obj=obj@entry=0x7fffe77fd450, topLevel=topLevel@entry=true) at /home/tsdgeos/devel/poppler/poppler/Gfx.cc:714
#13 0x00007ffff6f70d69 in Page::displaySlice (this=0x7fffd8006730, out=0x7fffe77fd650, out@entry=0x4052000000000000, hDPI=hDPI@entry=72, vDPI=vDPI@entry=0, rotate=0, rotate@entry=32767, useMediaBox=useMediaBox@entry=8, crop=crop@entry=255, sliceX=-1,
sliceX@entry=32767, sliceY=-1, sliceW=-1, sliceH=-1, printing=false, abortCheckCbk=0x0, abortCheckCbkData=0x7fffe77fd9f8, annotDisplayDecideCbk=0x0, annotDisplayDecideCbkData=0x0, copyXRef=true) at /home/tsdgeos/devel/poppler/poppler/Page.cc:548
#14 0x00007ffff6f75549 in PDFDoc::displayPageSlice (this=<optimized out>, out=0x4052000000000000, out@entry=0x7fffe77fd650, page=-1910907934, hDPI=hDPI@entry=72, vDPI=0, vDPI@entry=72, rotate=32767, rotate@entry=0, useMediaBox=useMediaBox@entry=false,
crop=crop@entry=true, printing=<optimized out>, sliceX=<optimized out>, sliceY=<optimized out>, sliceW=<optimized out>, sliceH=<optimized out>, abortCheckCbk=<optimized out>, abortCheckCbkData=<optimized out>, annotDisplayDecideCbk=<optimized out>,
annotDisplayDecideCbkData=<optimized out>, copyXRef=true) at /home/tsdgeos/devel/poppler/poppler/PDFDoc.cc:664
#15 0x00007ffff7fa3895 in Poppler::renderToArthur (arthur_output=arthur_output@entry=0x7fffe77fd650, painter=painter@entry=0x7fffe77fd5f8, xres=xres@entry=72, yres=yres@entry=72, x=x@entry=-1, y=y@entry=-1, w=-1, h=-1, rotate=Poppler::Page::Rotate0, flags=...,
page=<optimized out>, page=<optimized out>) at /home/tsdgeos/devel/poppler/qt5/src/poppler-page.cc:491
#16 0x00007ffff7fa42fc in Poppler::Page::renderToImage (this=0x7fffd8005030, xres=72, yres=72, x=-1, y=-1, w=-1, h=-1, rotate=Poppler::Page::Rotate0, partialUpdateCallback=0x0, shouldDoPartialUpdateCallback=0x0, shouldAbortRenderCallback=0x0, payload=...)
at /usr/include/qt/QtCore/qflags.h:120
#17 0x00007ffff7fa47b0 in Poppler::Page::renderToImage (this=<optimized out>, xres=<optimized out>, yres=<optimized out>, x=<optimized out>, y=<optimized out>, w=<optimized out>, h=<optimized out>, rotate=Poppler::Page::Rotate0, partialUpdateCallback=0x0,
shouldDoPartialUpdateCallback=0x0, payload=...) at /home/tsdgeos/devel/poppler/qt5/src/poppler-page.cc:519
```https://gitlab.freedesktop.org/poppler/poppler/-/issues/693Display issues with lists and linux biolinum font2018-12-23T12:47:13Z8FordPrefect8Display issues with lists and linux biolinum fontHello,
currently I am using Fedora 29 with gnome. I have some problem with some files that were created with libreoffice using the font linux biolinum and that contain lists, in this case dotted lists.
To my surprise most pdf readers ca...Hello,
currently I am using Fedora 29 with gnome. I have some problem with some files that were created with libreoffice using the font linux biolinum and that contain lists, in this case dotted lists.
To my surprise most pdf readers can't display this correctly. Evince can't even display the pages anymore. It causes even glitches to the evince window. Okular can display most of it. But for example in italic the m's are replaced by spaced or not displayed properly.
The pdfs contain the font or at least a subset of it. They are displayed correctly within libreoffice draw and firefox on my machine. On other systems android, Windows my old ubuntu 16.04 they are shown correctly. This holds for both, new files created on the fedora system but also files created on ubuntu 16.04.
I don't know whether this belongs here but I was adviced on the fedora subreddit to come here and after reading about poppler it sounded logically.https://gitlab.freedesktop.org/poppler/poppler/-/issues/692null pointer dereference in XRef::getEntry2018-12-31T09:57:35Zskysidernull pointer dereference in XRef::getEntrypdfdetach crashes when it's feeded with a specific pdf file.
The command I run with is `pdfdetach -save 1 test.pdf`.
The backtrace is here:
```
Program received signal SIGSEGV, Segmentation fault.
0x082994de in XRefEntry::setFlag (this=0...pdfdetach crashes when it's feeded with a specific pdf file.
The command I run with is `pdfdetach -save 1 test.pdf`.
The backtrace is here:
```
Program received signal SIGSEGV, Segmentation fault.
0x082994de in XRefEntry::setFlag (this=0xe0, flag=XRefEntry::Parsing, value=false) at /work/poppler/poppler/XRef.h:85
85 flags &= ~mask;
(gdb) bt
#0 0x082994de in XRefEntry::setFlag (this=0xe0, flag=XRefEntry::Parsing, value=false) at /work/poppler/poppler/XRef.h:85
#1 0x08295fd1 in Parser::makeStream(Object&&, unsigned char*, CryptAlgorithm, int, int, int, int, bool) (this=0x8651ff8,
dict=<unknown type in /work/poppler/build/utils/pdfdetach, CU 0x225680, DIE 0x23466c>, fileKey=0x0, encAlgorithm=cryptNone, keyLength=1211043104, objNum=7, objGen=0, recursion=3,
strict=false) at /work/poppler/poppler/Parser.cc:303
#2 0x08296cd8 in Parser::getObj (this=0x8651ff8, simpleOnly=false, fileKey=0x0, encAlgorithm=cryptNone, keyLength=1211043104, objNum=7, objGen=0, recursion=2, strict=false)
at /work/poppler/poppler/Parser.cc:134
#3 0x08296ab8 in Parser::getObj (this=0x8651ff8, simpleOnly=false, fileKey=0x0, encAlgorithm=cryptNone, keyLength=1211043104, objNum=7, objGen=0, recursion=1, strict=false)
at /work/poppler/poppler/Parser.cc:93
#4 0x08296fa6 in Parser::getObj (this=0x8651ff8, simpleOnly=false, fileKey=0x0, encAlgorithm=cryptNone, keyLength=1211043104, objNum=7, objGen=0, recursion=0, strict=false)
at /work/poppler/poppler/Parser.cc:120
#5 0x083895fe in XRef::fetch (this=0x8652328, num=7, gen=0, recursion=0) at /work/poppler/poppler/XRef.cc:1132
#6 0x0838b199 in XRef::getCatalog (this=0x8652328) at /work/poppler/poppler/XRef.cc:1064
#7 0x08121c54 in Catalog::Catalog (this=0x8652820, docA=0x8652148) at /work/poppler/poppler/Catalog.cc:94
#8 0x082b6280 in PDFDoc::setup (this=0x8652148, ownerPassword=0x0, userPassword=0x0) at /work/poppler/poppler/PDFDoc.cc:292
#9 0x082b663a in PDFDoc::PDFDoc (this=0x8652148, fileNameA=0x8652038, ownerPassword=0x0, userPassword=0x0, guiDataA=0x0) at /work/poppler/poppler/PDFDoc.cc:170
#10 0x084f9eda in LocalPDFDocBuilder::buildPDFDoc (this=0x86520b0, uri=..., ownerPassword=0x0, userPassword=0x0, guiDataA=0x0) at /work/poppler/poppler/LocalPDFDocBuilder.cc:31
#11 0x08113a6a in main (argc=4, argv=0xffffd7a4) at /work/poppler/utils/pdfdetach.cc:150
```
I analyse the code and find in some situation, entry is null:
```(gdb) bt
#0 XRef::getEntry (this=0x8652328, i=7, complainIfMissing=false) at /work/poppler/poppler/XRef.cc:1552
#1 0x08295f8b in Parser::makeStream(Object&&, unsigned char*, CryptAlgorithm, int, int, int, int, bool) (this=0x8651ff8,
dict=<unknown type in /work/poppler/build/utils/pdfdetach, CU 0x225680, DIE 0x23466c>, fileKey=0x0, encAlgorithm=cryptNone, keyLength=1211043104, objNum=7, objGen=0, recursion=3,
strict=false) at /work/poppler/poppler/Parser.cc:301
#2 0x08296cd8 in Parser::getObj (this=0x8651ff8, simpleOnly=false, fileKey=0x0, encAlgorithm=cryptNone, keyLength=1211043104, objNum=7, objGen=0, recursion=2, strict=false)
at /work/poppler/poppler/Parser.cc:134
#3 0x08296ab8 in Parser::getObj (this=0x8651ff8, simpleOnly=false, fileKey=0x0, encAlgorithm=cryptNone, keyLength=1211043104, objNum=7, objGen=0, recursion=1, strict=false)
at /work/poppler/poppler/Parser.cc:93
#4 0x08296fa6 in Parser::getObj (this=0x8651ff8, simpleOnly=false, fileKey=0x0, encAlgorithm=cryptNone, keyLength=1211043104, objNum=7, objGen=0, recursion=0, strict=false)
at /work/poppler/poppler/Parser.cc:120
#5 0x083895fe in XRef::fetch (this=0x8652328, num=7, gen=0, recursion=0) at /work/poppler/poppler/XRef.cc:1132
#6 0x0838b199 in XRef::getCatalog (this=0x8652328) at /work/poppler/poppler/XRef.cc:1064
#7 0x08121c54 in Catalog::Catalog (this=0x8652820, docA=0x8652148) at /work/poppler/poppler/Catalog.cc:94
#8 0x082b6280 in PDFDoc::setup (this=0x8652148, ownerPassword=0x0, userPassword=0x0) at /work/poppler/poppler/PDFDoc.cc:292
#9 0x082b663a in PDFDoc::PDFDoc (this=0x8652148, fileNameA=0x8652038, ownerPassword=0x0, userPassword=0x0, guiDataA=0x0) at /work/poppler/poppler/PDFDoc.cc:170
#10 0x084f9eda in LocalPDFDocBuilder::buildPDFDoc (this=0x86520b0, uri=..., ownerPassword=0x0, userPassword=0x0, guiDataA=0x0) at /work/poppler/poppler/LocalPDFDocBuilder.cc:31
#11 0x08113a6a in main (argc=4, argv=0xffffd7a4) at /work/poppler/utils/pdfdetach.cc:150
(gdb) p entries
$19 = (XRefEntry *) 0x0
```
The problem is in XRef::getEntry
```
XRefEntry *XRef::getEntry(int i, bool complainIfMissing)
{
if (i >= size || entries[i].type == xrefEntryNone) {
if ((!xRefStream) && mainXRefEntriesOffset) {
if (!parseEntry(mainXRefEntriesOffset + 20*i, &entries[i])) {
error(errSyntaxError, -1, "Failed to parse XRef entry [{0:d}].", i);
}
```
There is lack of check where size is 0 and entries is null[nullpointerdereference.pdf](/uploads/b208588c92e16539930e2cc630775033/nullpointerdereference.pdf)https://gitlab.freedesktop.org/poppler/poppler/-/issues/690evince fails reading pdf with AESV3 256 encryption2018-12-18T21:14:15ZScott Moserevince fails reading pdf with AESV3 256 encryptionHi. This is created as suggested from [evince issue 446](https://gitlab.gnome.org/GNOME/evince/issues/446).
Evince is unable to open PDFs encrypted with 256 bit AES (AESv3) encryption.
I'm seeing this problem with evince 3.30.2 runnin...Hi. This is created as suggested from [evince issue 446](https://gitlab.gnome.org/GNOME/evince/issues/446).
Evince is unable to open PDFs encrypted with 256 bit AES (AESv3) encryption.
I'm seeing this problem with evince 3.30.2 running on Ubuntu (disco).
1. **Show some info on qpdf and evince versions.**
$ dpkg-query --show evince
evince 3.30.2-1
$ evince --version
GNOME Document Viewer 3.30.2
$ qpdf --version
qpdf version 8.2.1
2. **Download a PDF to work with.**
$ wget https://www.adobe.com/support/products/enterprise/knowledgecenter/media/c4611_sample_explain.pdf -q -O plain.pdf
$ md5sum plain.pdf
88bb00da1e9bab21e9cb13248b8770b1 plain.pdf
3. **Encrypt it using qpdf and AES 256.**
$ rm -f encrypted-256.pdf encrypted-128.pdf
$ qpdf --encrypt user-secret owner-secret 256 -- plain.pdf encrypted-256.pdf
$ egrep -a AES encrypted-256.pdf
<< /CF << /StdCF << /AuthEvent /DocOpen /CFM /AESV3 /Length 32 >> >> /Filter /Standard /Length 256 /O <a868eeb995f6ff82543b1f38ab35f99cd9fd3611ddcfbb93f845b895fe64633fbf4e2714dd4dae142ccb602a50ede355> /OE <95e714077d596a65fecf766c94144c09341c9ddedc6f4237852960de7fc6d417> /P -4 /Perms <f708e990e02ae1ddc85b5a120731edc1> /R 6 /StmF /StdCF /StrF /StdCF /U <f972aa5c9877fd6d6650ca7b2705e12141f9d9d711a3378cd5e51c77c5dbc291e5270b54a36015d38b111c1c562a0749> /UE <435b9bd03432ad84261eb3bf19e00ce236e3acc26d831359fa8d2bacf758d1d0> /V 5 >>
$ qpdf --password=user-secret --show-encryption encrypted-256.pdf
R = 6
P = -4
User password = user-secret
extract for accessibility: allowed
extract for any purpose: allowed
print low resolution: allowed
print high resolution: allowed
modify document assembly: allowed
modify forms: allowed
modify annotations: allowed
modify other: allowed
modify anything: allowed
stream encryption method: AESv3
string encryption method: AESv3
file encryption method: AESv3
4. **Attempt to view with evince.** supplying either user or owner password does not work.
5. **For comparision, try with AES 128 bit.**. evince works fine here.
$ qpdf --encrypt user-secret owner-secret 128 --use-aes=y -- plain.pdf encrypted-128.pdf
$ qpdf --password=owner-secret --show-encryption encrypted-128.pdf
R = 4
P = -4
User password = user-secret
extract for accessibility: allowed
extract for any purpose: allowed
print low resolution: allowed
print high resolution: allowed
modify document assembly: allowed
modify forms: allowed
modify annotations: allowed
modify other: allowed
modify anything: allowed
stream encryption method: AESv2
string encryption method: AESv2
file encryption method: AESv2https://gitlab.freedesktop.org/poppler/poppler/-/issues/687Expose method for setting poppler-data location in C++ frontend2018-12-25T22:26:28ZJeroen OomsExpose method for setting poppler-data location in C++ frontendThe R bindings are exclusively using the C++ frontend, except for the part below where we need to set the location of the poppler-data files (which we ship with the application):
```c
#include <GlobalParams.h>
void find_poppler_data(){
...The R bindings are exclusively using the C++ frontend, except for the part below where we need to set the location of the poppler-data files (which we ship with the application):
```c
#include <GlobalParams.h>
void find_poppler_data(){
static bool initiated = false;
if (!initiated && strlen(poppler_data)){
globalParams = new GlobalParams(poppler_data);
initiated = true;
}
}
```
It would be great if this can be exposed in the C++ API so we don't need the legacy API.https://gitlab.freedesktop.org/poppler/poppler/-/issues/686poppler-data needs updating2020-09-26T21:39:41ZAlbert Astals Cidpoppler-data needs updatingThere's new versions of
https://github.com/adobe-type-tools/cmap-resources/releases
https://github.com/adobe-type-tools/mapping-resources-pdf/releasesThere's new versions of
https://github.com/adobe-type-tools/cmap-resources/releases
https://github.com/adobe-type-tools/mapping-resources-pdf/releases