I found a PDF file online, which makes Okular and my own program using poppler-qt4 crash.
The file itself is 11MB large, so I won't attach it, but you can fetch it at https://msb.se/RibData/Filer/pdf/24918.pdf
Unfortunately, I have no debug build of poppler-0.22 available, but the backtrace of my own program in gdb looks like this:
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff5489af4 in TextPage::beginWord(GfxState*) () from /usr/lib/libpoppler.so.34
#0 0x00007ffff5489af4 in TextPage::beginWord(GfxState*) () from /usr/lib/libpoppler.so.34
#1 0x00007ffff548a3b9 in TextPage::addChar(GfxState*, double, double, double, double, unsigned int, int, unsigned int*, int) () from /usr/lib/libpoppler.so.34
#2 0x00007ffff549143e in ActualText::end(GfxState*) () from /usr/lib/libpoppler.so.34
#3 0x00007ffff5418ef1 in Gfx::opEndMarkedContent(Object*, int) () from /usr/lib/libpoppler.so.34
#4 0x00007ffff541a6c4 in Gfx::go(bool) () from /usr/lib/libpoppler.so.34
#5 0x00007ffff541ab30 in Gfx::display(Object*, bool) () from /usr/lib/libpoppler.so.34
#6 0x00007ffff545c20c in Page::displaySlice(OutputDev*, double, double, int, bool, bool, int, int, int, int, bool, bool (*)(void*), void*, bool (*)(Annot*, void*), void*) ()
#7 0x00007ffff7ba6dbb in Poppler::Page::text(QRectF const&, Poppler::Page::TextLayout) const () from /usr/lib/libpoppler-qt4.so.4
#8 0x00007ffff7ba6ebb in Poppler::Page::text(QRectF const&) const () from /usr/lib/libpoppler-qt4.so.4
#9 0x0000000000427f03 in FileAnalyzerPDF::plainText(Poppler::Document*) ()
FileAnalyzerPDF is my own class that uses poppler.
The crash occurs in Okular when flipping from page 4 to page 5, i.e. the first four pages can be viewed without problems.
The test file can be processed with Ghostscript without warnings. Acrobat Reader 10.1.13 under Windows can handle this file, too.
I am using an up-to-date ArchLinux, Okular 0.15.5, KDE 4.9.5, poppler(-qt) 0.22.0-1.
Created attachment 73247 [details] [review]
We are calling ->getWmode() on a null pointer. Add a null check for that fixes the problem.