Bug 462304 - Okular and other poppler related tools cannot handle some pdf pages
Summary: Okular and other poppler related tools cannot handle some pdf pages
Status: RESOLVED UPSTREAM
Alias: None
Product: okular
Classification: Applications
Component: PDF backend (show other bugs)
Version: 22.08.1
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-11-27 11:24 UTC by cipricus
Modified: 2022-11-28 12:03 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
example of the pdf page Okular views as blank (444.79 KB, application/pdf)
2022-11-27 11:24 UTC, cipricus
Details

Note You need to log in before you can comment on or make changes to this bug.
Description cipricus 2022-11-27 11:24:06 UTC
Created attachment 154078 [details]
example of the pdf page Okular views as blank

Okular cannot see the content of many pages of an old scanned book. they appear blank although many other tools can see them just fine (internet browser except Falkon, Adobe Reader, Foxit, Master PDF, WPS PDF,  LibreOffice Draw, ImageMagick, mupdf, PDF Studio Viewer).

 The problem seems to be with poppler, because qpdfviewer and Falkon have the same problem. As far as I could test Evince cannot even open that pdf.

I couldn't get technical details on that type of page, so I'll upload here a sample.

More details at links posted here: https://www.reddit.com/r/kde/comments/z591ia/how_come_only_okular_cannot_see_this_pdf_page/?utm_source=share&utm_medium=web2x&context=3
Comment 1 cipricus 2022-11-27 11:30:30 UTC
> internet browser except Falkon, Adobe Reader, Foxit, Master PDF, WPS PDF,  LibreOffice Draw, ImageMagick, mupdf, PDF Studio Viewer

What I mean is: only Okular, qpdfview, Falkon and Evince seem affected; the rest of the tools that I've tested (internet browsers - excepting Falkon -, Adobe Reader, Foxit, Master PDF, WPS PDF,  LibreOffice Draw, ImageMagick, mupdf, PDF Studio Viewer) are not affected.
Comment 2 cipricus 2022-11-27 11:33:30 UTC
Comment on attachment 154078 [details]
example of the pdf page Okular views as blank

Open that in Okular or qpdfview: only a footer is see. Open it in an internet browser other than Falkon, in adobe Reader, Foxit reader, mupdf, Master pdf etc and the page is seen in full.
Comment 3 cipricus 2022-11-27 11:35:23 UTC
If that page is printed as pdf in Firefox or (after selecting "print as image") in Chromium/Chrome-based browsers, the resulting pdf is seen ok in Okular.
Comment 4 Nicolas Fella 2022-11-27 14:33:26 UTC
When opening that file poppler prints "Bogus memory allocation size". Presumably because the embedded image data is too large in some way.

The allocation seems to come from https://gitlab.freedesktop.org/poppler/poppler/-/blob/master/poppler/JBIG2Stream.cc#L1575

numInputSyms is 0, numNewSyms is 3092673499. 3092673499 is larger than 2^31 and smaller than 2^32. It is stored as unsigned int, so that's fine, but when passing that to gmallocn_checkoverflow it gets converted to int causing an overflow. Once it reaches https://gitlab.freedesktop.org/poppler/poppler/-/blob/master/goo/gmem.h#L112 count is -1202293797 and the allocation fails
Comment 5 Oliver Sander 2022-11-27 15:11:52 UTC
Can you post a poppler bug for this, please?
Comment 6 cipricus 2022-11-27 18:28:21 UTC
(In reply to Oliver Sander from comment #5)
> Can you post a poppler bug for this, please?

Are you addressing me or the previous comment?  Should I post that bug?
Comment 7 Oliver Sander 2022-11-28 09:09:48 UTC
Yes please.  You should be able to reproduce the bug with the `pdftoppm` tool (which is part of poppler).  That way, your bug report becomes independent from Okular.
Comment 8 cipricus 2022-11-28 10:35:35 UTC
(In reply to Oliver Sander from comment #7)
> Yes please.  You should be able to reproduce the bug with the `pdftoppm`
> tool (which is part of poppler).  That way, your bug report becomes
> independent from Okular.

I see, I have tested with Atril and Evince and they are no better than Okular, clearly this is not Okular-specific.
Comment 9 cipricus 2022-11-28 10:38:32 UTC
(In reply to Oliver Sander from comment #7)
> Yes please.  You should be able to reproduce the bug with the `pdftoppm`
> tool (which is part of poppler).  That way, your bug report becomes
> independent from Okular.

Sorry, what is the exact package affected by the bug? Is it called "poppler"? Or "poppler-utils"?

 Should the bug report be posted here? Or because it'd not a kde bug must be posted under a different bug-reporting website?
Comment 10 cipricus 2022-11-28 11:09:37 UTC
(In reply to Oliver Sander from comment #7)
> Yes please.  You should be able to reproduce the bug with the `pdftoppm`
> tool (which is part of poppler).  That way, your bug report becomes
> independent from Okular.

I have posted as a popple bug here: https://gitlab.freedesktop.org/poppler/poppler/-/issues/1319
Comment 11 Nicolas Fella 2022-11-28 12:03:49 UTC
Thanks for creating the poppler bug report. I will close this then