Bug 490203 - Skanpage immediately crashes if you import a PDF
Summary: Skanpage immediately crashes if you import a PDF
Status: RESOLVED FIXED
Alias: None
Product: Skanpage
Classification: Applications
Component: general (show other bugs)
Version: 24.05.0
Platform: Fedora RPMs Linux
: NOR crash
Target Milestone: ---
Assignee: Alexander Stippich
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-07-12 23:36 UTC by skierpage
Modified: 2024-09-14 16:15 UTC (History)
0 users

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


Attachments
trivial PDF (exported from LibreOffice Writer) that crashes Skanpage on import (21.66 KB, application/pdf)
2024-07-12 23:36 UTC, skierpage
Details

Note You need to log in before you can comment on or make changes to this bug.
Description skierpage 2024-07-12 23:36:24 UTC
Created attachment 171618 [details]
trivial PDF (exported from LibreOffice Writer) that crashes Skanpage on import

SUMMARY
See Summary

STEPS TO REPRODUCE
1. Open Skanpage
2. Click Import
3. Navigate to a PDF and open

OBSERVED RESULT
Immediate crash. I repeated with a different PDF.
The KDE Crash Reporter started up both times. The first time I don't know where the report went, the second time I tried to see the backtrace and it overloaded my 8GB Thinkpad, so I killed it.
I ran skanpage a third time under gdb and imported the attached trivial PDF, and here's the partial backtrace:

Thread 1 "skanpage" received signal SIGSEGV, Segmentation fault.
0x00007ffff7f8f28d in KSaneCore::Option::value (this=0x0) at /usr/src/debug/ksanecore-24.05.0-1.fc40.x86_64/src/option.cpp:116
116         if (d->option != nullptr) {                                                                                                                
Missing separate debuginfos, use: dnf debuginfo-install skanpage-24.05.0-1.fc40.x86_64
(gdb) bt
#0  0x00007ffff7f8f28d in KSaneCore::Option::value (this=0x0) at /usr/src/debug/ksanecore-24.05.0-1.fc40.x86_64/src/option.cpp:116
#1  0x000055555558fb98 in Skanpage::importFile (this=0x7fffffffd720, fileUrl=...)
    at /usr/src/debug/skanpage-24.05.0-1.fc40.x86_64/src/Skanpage.cpp:691
#2  Skanpage::qt_static_metacall (_o=0x7fffffffd720, _c=<optimized out>, _id=<optimized out>, _a=0x7fffffff9cd8)
    at /usr/src/debug/skanpage-24.05.0-1.fc40.x86_64/redhat-linux-build/src/skanpage_autogen/include/moc_Skanpage.cpp:463
#3  0x0000555555591574 in Skanpage::qt_metacall (this=0x7fffffffd720, _c=QMetaObject::InvokeMetaMethod, _id=33, _a=0x7fffffff9cd8)
    at /usr/src/debug/skanpage-24.05.0-1.fc40.x86_64/redhat-linux-build/src/skanpage_autogen/include/moc_Skanpage.cpp:631
#4  0x00007ffff63b3caa in QQmlObjectOrGadget::metacall
...

EXPECTED RESULT
1. Don't crash.
2. At a minimum Skanpage should detect mime type, sniff the file, etc. and warn something like "Unsupported file type (application/pdf); supported image types include JPG, PNG, ..." I don't know if it should have a "[Proceed to scan anyway]" button.
3. (Enhancement) Skanpage should support PDF files.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma:
KDE Plasma Version: 6.1.2
KDE Frameworks Version:  6.3.0
Qt Version: 6.7.2 (built against 6.7.1)

ADDITIONAL INFORMATION
 gImageReader (gimagereader-qt5) can scan PDFs fine. It's probably using libpoppler to render PDF files and examine their structure to directly extract any text.
Comment 1 Alexander Stippich 2024-07-22 08:08:22 UTC
is QtPDF installed? maybe the dependency was not updater properly
Comment 2 skierpage 2024-08-17 09:00:33 UTC
(In reply to Alexander Stippich from comment #1)
> is QtPDF installed? maybe the dependency was not updater properly

Yes, qt6-qtpdf 6.7.2 is installed from Source qt6-qtwebengine-6.7.2-1.fc40.src.rpm, and skanpage should locate it OK:

    % ldd /usr/bin/skanpage| rg -i pdf
        libQt6Pdf.so.6 => /lib64/libQt6Pdf.so.6 (0x00007fcbae800000)
Comment 3 Bug Janitor Service 2024-09-14 14:54:43 UTC
A possibly relevant merge request was started @ https://invent.kde.org/utilities/skanpage/-/merge_requests/81
Comment 4 Alexander Stippich 2024-09-14 16:15:33 UTC
Git commit 7b06fb345d42712f1ac209bc2b3f4468e42a29f8 by Alexander Stippich.
Committed on 14/09/2024 at 10:30.
Pushed by astippich into branch 'master'.

guard against nullptr when trying to import a file
Related: bug 492043

M  +4    -1    src/Skanpage.cpp

https://invent.kde.org/utilities/skanpage/-/commit/7b06fb345d42712f1ac209bc2b3f4468e42a29f8