Bug 416055 - PDF document with weird signature makes okular crash
Summary: PDF document with weird signature makes okular crash
Status: RESOLVED DUPLICATE of bug 407731
Alias: None
Product: okular
Classification: Applications
Component: PDF backend (show other bugs)
Version: 1.7.0
Platform: Mageia RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-01-09 16:22 UTC by Northsoft
Modified: 2020-01-09 18:01 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Bad pdf file (deleted)
2020-01-09 16:22 UTC, Northsoft
Details
GDB output (4.83 KB, text/plain)
2020-01-09 16:22 UTC, Northsoft
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Northsoft 2020-01-09 16:22:00 UTC
Created attachment 125003 [details]
Bad pdf file

SUMMARY
PDF document with weird signature makes okular crash
Dereferencing a null pointer at libnss source

STEPS TO REPRODUCE
1. Open an attachment in okular

OBSERVED RESULT
1. Segmentation fäult

EXPECTED RESULT
1. Opened document and a message «error processing signature»

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 5.4.6-desktop-2.mga7 x86_64
KDE Plasma Version: plasmashell 5.15.4
KDE Frameworks Version: 5.57.0
Qt Version: 5.12.6

ADDITIONAL INFORMATION
See bad pdf file in attachment. GDB output:
(gdb) run doc.pdf
Starting program: /usr/bin/okular doc.pdf
Missing separate debuginfos, use: debuginfo-install glibc-2.29-19.mga7.x86_64
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
[New Thread 0x7ffff0b9e700 (LWP 25581)]
[New Thread 0x7fffeb28f700 (LWP 25582)]
Missing separate debuginfo for /lib64/libOkular5Core.so.9
Try: dnf --enablerepo='*debug*' install /usr/lib/debug/.build-id/fe/7b6a079bde5ccc1e08158c15046b9e6a06c1be.debug
Or try: urpmi  /usr/lib/debug/.build-id/fe/7b6a079bde5ccc1e08158c15046b9e6a06c1be.debug
[New Thread 0x7fffe337f700 (LWP 25583)]
[New Thread 0x7fffe2b7e700 (LWP 25584)]
[New Thread 0x7fffe237d700 (LWP 25585)]
[New Thread 0x7fffe1b7c700 (LWP 25586)]
ERROR: Unrecognized Hash ID

Thread 1 "okular" received signal SIGSEGV, Segmentation fault.
0x00007fffe0f968d3 in HASH_End (context=0x0, result=0xc62360 "\360", <incomplete sequence \306>, result_len=0x7fffffffcbac, max_result_len=0)
    at sechash.c:462
462         (*context->hashobj->end)(context->hash_context, result, result_len,
(gdb) bt
#0  0x00007fffe0f968d3 in HASH_End (context=0x0, result=0xc62360 "\360", <incomplete sequence \306>, result_len=0x7fffffffcbac, max_result_len=0)
    at sechash.c:462
#1  0x00007fffe12b0118 in SignatureHandler::validateSignature() () from /lib64/libpoppler.so.85
#2  0x00007fffe11ae19b in FormFieldSignature::validateSignature(bool, bool, long) () from /lib64/libpoppler.so.85
#3  0x00007fffe82ccaa5 in Poppler::FormFieldSignature::validate(int, QDateTime const&) const () from /lib64/libpoppler-qt5.so.1
#4  0x00007fffe82cd591 in Poppler::FormFieldSignature::validate(Poppler::FormFieldSignature::ValidateOptions) const ()
   from /lib64/libpoppler-qt5.so.1
#5  0x00007fffe851c4c0 in PopplerFormFieldSignature::PopplerFormFieldSignature (this=0xaf9df0, field=0xaf95d0)
    at /usr/src/debug/okular-19.04.0-1.mga7.x86_64/generators/poppler/formfields.cpp:387
#6  0x00007fffe8516848 in PDFGenerator::addFormFields (this=<optimized out>, popplerPage=<optimized out>, page=<optimized out>)
    at /usr/src/debug/okular-19.04.0-1.mga7.x86_64/generators/poppler/generator_pdf.cpp:1978
#7  0x00007fffe8516ca0 in PDFGenerator::loadPages (this=this@entry=0x674180, pagesVector=..., rotation=rotation@entry=0, clear=clear@entry=false)
    at /usr/src/debug/okular-19.04.0-1.mga7.x86_64/generators/poppler/generator_pdf.cpp:787
#8  0x00007fffe8516fee in PDFGenerator::init (this=this@entry=0x674180, pagesVector=..., password=...)
    at /usr/src/debug/okular-19.04.0-1.mga7.x86_64/generators/poppler/generator_pdf.cpp:683
#9  0x00007fffe8517184 in PDFGenerator::loadDocumentWithPassword (this=0x674180, filePath=..., pagesVector=..., password=...)
    at /usr/src/debug/okular-19.04.0-1.mga7.x86_64/generators/poppler/generator_pdf.cpp:638
#10 0x00007fffe9de6755 in Okular::DocumentPrivate::openDocumentInternal(KPluginMetaData const&, bool, QString const&, QByteArray const&, QString const&) () from /lib64/libOkular5Core.so.9
#11 0x00007fffe9de6d5a in Okular::Document::openDocument(QString const&, QUrl const&, QMimeType const&, QString const&) ()
   from /lib64/libOkular5Core.so.9
#12 0x00007fffe9f5115b in Okular::Part::doOpenFile (this=this@entry=0x437440, mimeA=..., fileNameToOpenA=..., 
    isCompressedFile=isCompressedFile@entry=0x7fffffffd397) at /usr/src/debug/okular-19.04.0-1.mga7.x86_64/part.cpp:1415
#13 0x00007fffe9f5150e in Okular::Part::openFile (this=0x437440) at /usr/src/debug/okular-19.04.0-1.mga7.x86_64/part.cpp:1549
#14 0x00007ffff7f5a3ac in ?? () from /lib64/libKF5Parts.so.5
#15 0x00007ffff7f5b22e in KParts::ReadOnlyPart::openUrl(QUrl const&) () from /lib64/libKF5Parts.so.5
#16 0x00007fffe9f43d1e in Okular::Part::openUrl (this=0x437440, _url=..., swapInsteadOfOpening=<optimized out>)
    at /usr/src/debug/okular-19.04.0-1.mga7.x86_64/part.cpp:1755
#17 0x00000000004144d8 in Shell::openUrl (this=0x4dbea0, url=..., serializedOptions=...)
    at /usr/src/debug/okular-19.04.0-1.mga7.x86_64/shell/shell.cpp:280
#18 0x0000000000414736 in Shell::openDocument (this=0x4dbea0, url=..., serializedOptions=...)
    at /usr/src/debug/okular-19.04.0-1.mga7.x86_64/shell/shell.cpp:221
#19 0x000000000040d20f in Okular::main (paths=..., serializedOptions=...) at /usr/src/debug/okular-19.04.0-1.mga7.x86_64/shell/okular_main.cpp:176
#20 0x000000000040c955 in main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/okular-19.04.0-1.mga7.x86_64/shell/main.cpp:74
(gdb) l
457     HASH_End(HASHContext *context,
458              unsigned char *result,
459              unsigned int *result_len,
460              unsigned int max_result_len)
461     {
462         (*context->hashobj->end)(context->hash_context, result, result_len,
463                                  max_result_len);
464         return;
465     }
466
(gdb) p context
$1 = (HASHContext *) 0x0
(gdb)
Comment 1 Northsoft 2020-01-09 16:22:49 UTC
Created attachment 125004 [details]
GDB output
Comment 2 Yuri Chornoivan 2020-01-09 16:31:18 UTC

*** This bug has been marked as a duplicate of bug 407731 ***
Comment 3 Northsoft 2020-01-09 16:43:49 UTC
It's not a duplicate of bug 407731, i'm able to open a file from that ticket.
Comment 4 Yuri Chornoivan 2020-01-09 16:46:02 UTC
(In reply to Northsoft from comment #3)
> It's not a duplicate of bug 407731, i'm able to open a file from that ticket.

Can you update to some more recent version of poppler? I can safely open your file with poppler 0.82.
Comment 5 Northsoft 2020-01-09 17:02:09 UTC
(In reply to Yuri Chornoivan from comment #4)
> Can you update to some more recent version of poppler? I can safely open
> your file with poppler 0.82.

rpm -qa | grep -i poppler:
lib64poppler-qt5_1-0.74.0-3.2.mga7
poppler-0.74.0-3.2.mga7
lib64poppler-gir0.18-0.74.0-3.2.mga7
lib64poppler85-0.74.0-3.2.mga7
poppler-data-0.4.9-2.mga7
lib64poppler-glib8-0.74.0-3.2.mga7

These packages are the most recent from Mageia 7 repo.
Comment 6 Yuri Chornoivan 2020-01-09 17:17:17 UTC
(In reply to Northsoft from comment #5)
> (In reply to Yuri Chornoivan from comment #4)
> > Can you update to some more recent version of poppler? I can safely open
> > your file with poppler 0.82.
> 
> rpm -qa | grep -i poppler:
> lib64poppler-qt5_1-0.74.0-3.2.mga7
> poppler-0.74.0-3.2.mga7
> lib64poppler-gir0.18-0.74.0-3.2.mga7
> lib64poppler85-0.74.0-3.2.mga7
> poppler-data-0.4.9-2.mga7
> lib64poppler-glib8-0.74.0-3.2.mga7
> 
> These packages are the most recent from Mageia 7 repo.

Same distro here. Self-compiled poppler and Okular. So you can switch to Cauldron or compile+install poppler and okular by yourself. That's not that hard:

1. Install dependencies (gcc, cmake, kf5 libs).

2. http://www.linuxfromscratch.org/blfs/view/svn/general/poppler.html

3. Rebuild Okular:

git clone git@invent.kde.org:kde/okular.git
cd okular
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DKDE_INSTALL_PLUGINDIR=/usr/lib64/qt5/plugins ..
make -j3
su -c "make install/strip"

4. Rebuild Kile, KBibTeX in a similar way. Everything should work fine.
Comment 7 Northsoft 2020-01-09 17:52:33 UTC
Thanks, issue is resolved, please delete a PDF file because it contains personal data (address and state ID number).
Comment 8 Ben Cooksley 2020-01-09 17:53:33 UTC
The content of attachment 125003 [details] has been deleted for the following reason:

Contains personally identifying information
Comment 9 Ben Cooksley 2020-01-09 17:54:01 UTC
Out of curiosity, how did you know to add me to get the attachment removed?
Comment 10 Yuri Chornoivan 2020-01-09 17:55:04 UTC
(In reply to Ben Cooksley from comment #9)
> Out of curiosity, how did you know to add me to get the attachment removed?

I have told him to do so.
Comment 11 Ben Cooksley 2020-01-09 18:01:38 UTC
Thanks for confirming that Yuri