Bug 499746 - Okular crashes when adding zero-size signature with background image
Summary: Okular crashes when adding zero-size signature with background image
Status: RESOLVED FIXED
Alias: None
Product: okular
Classification: Applications
Component: PDF backend (show other bugs)
Version: unspecified
Platform: Debian testing Linux
: NOR crash
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-02-10 09:45 UTC by Oliver Sander
Modified: 2025-02-17 10:00 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Oliver Sander 2025-02-10 09:45:38 UTC
I have started to add a background image when digitally signing pdf files. This seems to work well enough. 

However, Okular crashes when, instead of drawing a rectangle for the signature, I simply click on the screen. This happens reliably, for any pdf and image files I have tried. It does not happen when signing without a background image.

Both my poppler and Okular are self-compiled, from today's master branches.

SOFTWARE/OS VERSIONS
Operating System: Debian GNU/Linux 12
KDE Plasma Version: 6.2.5
KDE Frameworks Version: 6.10.0
Qt Version: 6.7.2
Kernel Version: 6.12.11-amd64 (64-bit)
Graphics Platform: Wayland
Processors: 8 × Intel® Core™ i7-8565U CPU @ 1.80GHz
Memory: 15.3 GiB of RAM
Graphics Processor: Mesa Intel® UHD Graphics 620
Comment 1 Oliver Sander 2025-02-10 09:46:21 UTC
Here is a backtrace:

[10::34:37.893] unknown: ASSERT: "nativeAnnot" in file /home/sander/poppler/qt6/src/poppler-annotation.cc, line 801

Thread 1 "okular" received signal SIGABRT, Aborted.
__pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0)
    at ./nptl/pthread_kill.c:44
warning: 44     ./nptl/pthread_kill.c: Datei oder Verzeichnis nicht gefunden
(gdb) bt
#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0)
    at ./nptl/pthread_kill.c:44
#1  0x00007ffff589de2f in __pthread_kill_internal (threadid=<optimized out>, signo=6) at ./nptl/pthread_kill.c:78
#2  0x00007ffff5849d02 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3  0x00007ffff58324f0 in __GI_abort () at ./stdlib/abort.c:79
#4  0x00007ffff5ed6882 in qAbort() () at /lib/x86_64-linux-gnu/libQt6Core.so.6
#5  0x00007ffff5f25ef0 in ??? () at /lib/x86_64-linux-gnu/libQt6Core.so.6
#6  0x00007ffff5ed738d in QMessageLogger::fatal(char const*, ...) const () at /lib/x86_64-linux-gnu/libQt6Core.so.6
#7  0x00007ffff5ed73e9 in qt_assert(char const*, char const*, int) () at /lib/x86_64-linux-gnu/libQt6Core.so.6
#8  0x00007fffb84b0920 in Poppler::AnnotationPrivate::addAnnotationToPage
    (pdfPage=0x5555567be9b0, doc=<optimized out>, ann=0x555556b35a80)
    at /home/sander/poppler/qt6/src/poppler-annotation.cc:801
#9  0x00007fffb85e0636 in PopplerAnnotationProxy::notifyAddition
    (this=0x555556a751c0, okl_ann=0x555556b77530, page=1)
    at /home/sander/kde-invent/okular/generators/poppler/annots.cpp:602
#10 0x00007fffd06b6deb in Okular::DocumentPrivate::performAddPageAnnotation
    (this=0x555555b1e050, page=1, annotation=0x555556b77530)
    at /home/sander/kde-invent/okular/core/document.cpp:1075
#11 0x00007fffd0725cc5 in Okular::AddAnnotationCommand::redo (this=0x555556b268e0)
    at /home/sander/kde-invent/okular/core/documentcommands.cpp:82
#12 0x00007ffff690d4ef in QUndoStack::push(QUndoCommand*) () at /lib/x86_64-linux-gnu/libQt6Gui.so.6
#13 0x00007fffd06c5440 in Okular::Document::addPageAnnotation
    (this=0x555555840cb0, page=1, annotation=0x555556b77530)
    at /home/sander/kde-invent/okular/core/document.cpp:3520
#14 0x00007fffd0bcd4e7 in PageViewAnnotator::performRouteMouseOrTabletEvent
    (this=0x555555947270, eventType=AnnotatorEngine::Release, button=AnnotatorEngine::Left, modifiers=..., pos=..., item=0x555555b8b9d0) at /home/sander/kde-invent/okular/part/pageviewannotator.cpp:1104
#15 0x00007fffd0bcd78f in PageViewAnnotator::routeMouseEvent
    (this=0x555555947270, e=0x7fffffffc6b0, item=0x555555b8b9d0)
    at /home/sander/kde-invent/okular/part/pageviewannotator.cpp:1182
#16 0x00007fffd0bf5e45 in PageView::mouseReleaseEvent (this=0x555555807a20, e=0x7fffffffc6b0)
    at /home/sander/kde-invent/okular/part/pageview.cpp:2574
#17 0x00007ffff6ffee93 in QWidget::event(QEvent*) () at /lib/x86_64-linux-gnu/libQt6Widgets.so.6
#18 0x00007ffff7090bc4 in QFrame::event(QEvent*) () at /lib/x86_64-linux-gnu/libQt6Widgets.so.6
#19 0x00007fffd0bfbae7 in PageView::viewportEvent (this=0x555555807a20, e=0x7fffffffc6b0)
    at /home/sander/kde-invent/okular/part/pageview.cpp:3361
#20 0x00007ffff5f85e1a in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) ()
    at /lib/x86_64-linux-gnu/libQt6Core.so.6
--Type <RET> for more, q to quit, c to continue without paging--
#21 0x00007ffff6fb2092 in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
    at /lib/x86_64-linux-gnu/libQt6Widgets.so.6
#22 0x00007ffff6fb6c10 in QApplication::notify(QObject*, QEvent*) () at /lib/x86_64-linux-gnu/libQt6Widgets.so.6
#23 0x00007ffff5f87928 in QCoreApplication::notifyInternal2(QObject*, QEvent*) ()
    at /lib/x86_64-linux-gnu/libQt6Core.so.6
#24 0x00007ffff6fab4be in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool, bool) () at /lib/x86_64-linux-gnu/libQt6Widgets.so.6
#25 0x00007ffff7012488 in ??? () at /lib/x86_64-linux-gnu/libQt6Widgets.so.6
#26 0x00007ffff7015838 in ??? () at /lib/x86_64-linux-gnu/libQt6Widgets.so.6
#27 0x00007ffff6fb20a2 in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
    at /lib/x86_64-linux-gnu/libQt6Widgets.so.6
#28 0x00007ffff5f87928 in QCoreApplication::notifyInternal2(QObject*, QEvent*) ()
    at /lib/x86_64-linux-gnu/libQt6Core.so.6
#29 0x00007ffff65c935b in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) ()
    at /lib/x86_64-linux-gnu/libQt6Gui.so.6
#30 0x00007ffff6622a1c in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
    at /lib/x86_64-linux-gnu/libQt6Gui.so.6
#31 0x00007ffff6966b34 in ??? () at /lib/x86_64-linux-gnu/libQt6Gui.so.6
#32 0x00007ffff3ebd81f in ??? () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#33 0x00007ffff3ebfa57 in ??? () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#34 0x00007ffff3ec01c0 in g_main_context_iteration () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#35 0x00007ffff618c473 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
    at /lib/x86_64-linux-gnu/libQt6Core.so.6
#36 0x00007ffff5f92adb in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) ()
    at /lib/x86_64-linux-gnu/libQt6Core.so.6
#37 0x00007ffff5f8a908 in QCoreApplication::exec() () at /lib/x86_64-linux-gnu/libQt6Core.so.6
#38 0x000055555557474b in main (argc=1, argv=0x7fffffffd928) at /home/sander/kde-invent/okular/shell/main.cpp:123
Comment 2 Sune Vuorela 2025-02-10 10:12:37 UTC
I think it is the issue I also pointed out here:
https://gitlab.freedesktop.org/poppler/poppler/-/merge_requests/1560#note_2594561

What would your expected behavior be? (of course, not crashing, but ..), should okular give an error and refuse? Should you get a signature without a visual representation? or ?
Comment 3 Oliver Sander 2025-02-10 10:26:02 UTC
Right now you get a signature without visual representation. I don't know whether that is the optimal user experience, but at least it has a certain logic to it.

The import point is the crash here -- I think the rest is a separate topic.
Comment 4 Bug Janitor Service 2025-02-11 09:12:38 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/okular/-/merge_requests/1127
Comment 5 Sune Vuorela 2025-02-17 08:56:24 UTC
Git commit e554ef9d054a2682ec7ac550987c9eef93d0937e by Sune Vuorela.
Committed on 17/02/2025 at 08:15.
Pushed by sune into branch 'master'.

Signatures: Don't do too small background images

Unfortunately poppler fails to embed and crashes.

M  +29   -8    generators/poppler/annots.cpp

https://invent.kde.org/graphics/okular/-/commit/e554ef9d054a2682ec7ac550987c9eef93d0937e
Comment 6 Sune Vuorela 2025-02-17 10:00:10 UTC
Git commit 2c46c771b5bc998c6c909764b5cd3f23c71504d1 by Sune Vuorela, on behalf of Sune Vuorela.
Committed on 17/02/2025 at 09:46.
Pushed by sune into branch 'release/24.12'.

Signatures: Don't do too small background images

Unfortunately poppler fails to embed and crashes.


(cherry picked from commit e554ef9d054a2682ec7ac550987c9eef93d0937e)

Co-authored-by: Sune Vuorela <sune@vuorela.dk>

M  +29   -8    generators/poppler/annots.cpp

https://invent.kde.org/graphics/okular/-/commit/2c46c771b5bc998c6c909764b5cd3f23c71504d1