Bug 462312 - Okular crash on editing form
Summary: Okular crash on editing form
Status: RESOLVED UPSTREAM
Alias: None
Product: okular
Classification: Applications
Component: general (show other bugs)
Version: 22.08.3
Platform: Neon Linux
: NOR crash
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords: drkonqi
Depends on:
Blocks:
 
Reported: 2022-11-27 13:38 UTC by Sylvain Bouchet
Modified: 2023-05-22 19:45 UTC (History)
4 users (show)

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


Attachments
the form is in this pdf (41.17 KB, application/pdf)
2022-11-27 13:41 UTC, Sylvain Bouchet
Details
New crash information added by DrKonqi (5.33 KB, text/plain)
2023-01-18 11:34 UTC, Johannes Falke
Details
New crash information added by DrKonqi (8.30 KB, text/plain)
2023-05-19 08:37 UTC, Riccardo Escher
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sylvain Bouchet 2022-11-27 13:38:14 UTC
Application: okular (22.08.3)

Qt Version: 5.15.7
Frameworks Version: 5.100.0
Operating System: Linux 5.15.0-53-generic x86_64
Windowing System: X11
Distribution: KDE neon 5.26
DrKonqi: 5.26.3 [KCrashBackend]

-- Information about the crash:
When I edit a form (already used without problem) at the first letter I press, it crashes

The crash can be reproduced every time.

-- Backtrace:
Application: Okular (okular), signal: Segmentation fault

[KCrash Handler]
#4  0x00007f0bc9e24bc8 in GfxResources::doLookupFont(char const*) const () from /lib/x86_64-linux-gnu/libpoppler.so.124
#5  0x00007f0bc9e24d42 in GfxResources::lookupFont(char const*) () from /lib/x86_64-linux-gnu/libpoppler.so.124
#6  0x00007f0bc9e193f8 in Form::ensureFontsForAllCharacters(GooString const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, GfxResources*) () from /lib/x86_64-linux-gnu/libpoppler.so.124
#7  0x00007f0bc9e1a4f3 in ?? () from /lib/x86_64-linux-gnu/libpoppler.so.124
#8  0x00007f0bca0a630c in Poppler::FormFieldText::setText(QString const&) () from /lib/x86_64-linux-gnu/libpoppler-qt5.so.1
#9  0x00007f0bf440b29d in ?? () from /lib/x86_64-linux-gnu/libOkular5Core.so.10
#10 0x00007f0c05924819 in QUndoStack::push(QUndoCommand*) () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#11 0x00007f0bf4578f7a in ?? () from /usr/lib/x86_64-linux-gnu/qt5/plugins/okularpart.so
#12 0x00007f0c04a220f4 in ?? () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#13 0x00007f0bf457d311 in ?? () from /usr/lib/x86_64-linux-gnu/qt5/plugins/okularpart.so
#14 0x00007f0c04a220f4 in ?? () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#15 0x00007f0c056beef9 in QLineEdit::textEdited(QString const&) () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#16 0x00007f0c056bc3d8 in ?? () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#17 0x00007f0c04a22128 in ?? () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#18 0x00007f0c056c6709 in QWidgetLineControl::textEdited(QString const&) () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#19 0x00007f0c056c9e9b in QWidgetLineControl::finishChange(int, bool, bool) () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#20 0x00007f0c056ccb34 in QWidgetLineControl::processKeyEvent(QKeyEvent*) () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#21 0x00007f0c056befff in QLineEdit::keyPressEvent(QKeyEvent*) () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#22 0x00007f0c055b6708 in QWidget::event(QEvent*) () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#23 0x00007f0c05572763 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#24 0x00007f0c0557a4de in QApplication::notify(QObject*, QEvent*) () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#25 0x00007f0c049ea09a in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#26 0x00007f0c055d23ff in ?? () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#27 0x00007f0c05572763 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#28 0x00007f0c049ea09a in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#29 0x00007f0c04e63bfa in QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent*) () from /lib/x86_64-linux-gnu/libQt5Gui.so.5
#30 0x00007f0bfe0ab0a4 in ?? () from /usr/lib/x86_64-linux-gnu/qt5/plugins/platforminputcontexts/libibusplatforminputcontextplugin.so
#31 0x00007f0c04a220f4 in ?? () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#32 0x00007f0c04d039d3 in QDBusPendingCallWatcher::finished(QDBusPendingCallWatcher*) () from /lib/x86_64-linux-gnu/libQt5DBus.so.5
#33 0x00007f0c04a17afe in QObject::event(QEvent*) () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#34 0x00007f0c05572763 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#35 0x00007f0c049ea09a in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#36 0x00007f0c049ed187 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#37 0x00007f0c04a444a7 in ?? () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#38 0x00007f0c02f9ad1b in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#39 0x00007f0c02fef6f8 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#40 0x00007f0c02f983c3 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#41 0x00007f0c04a43af8 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#42 0x00007f0c049e89bb in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#43 0x00007f0c049f0f54 in QCoreApplication::exec() () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#44 0x000055b3756dcb98 in ?? ()
#45 0x00007f0c04305d90 in __libc_start_call_main (main=main@entry=0x55b3756db520, argc=argc@entry=2, argv=argv@entry=0x7ffcc028df68) at ../sysdeps/nptl/libc_start_call_main.h:58
#46 0x00007f0c04305e40 in __libc_start_main_impl (main=0x55b3756db520, argc=2, argv=0x7ffcc028df68, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffcc028df58) at ../csu/libc-start.c:392
#47 0x000055b3756dd635 in ?? ()
[Inferior 1 (process 9355) detached]

Reported using DrKonqi
Comment 1 Sylvain Bouchet 2022-11-27 13:41:12 UTC
Created attachment 154082 [details]
the form is in this pdf
Comment 2 Sylvain Bouchet 2022-11-27 17:04:43 UTC
For your information, I've recently update my system to be neon based on ubuntu 22.04 LTS
Comment 3 Johannes Falke 2023-01-18 11:34:54 UTC
Created attachment 155400 [details]
New crash information added by DrKonqi

okular (22.12.0) using Qt 5.15.7

1) Open (specific) form in Okular
2.1) Enable "Show forms"
2.2) Click on form cell
2.3) Type first character
3) Crash

-- Backtrace (Reduced):
#4  0x00007f175f76089c in GfxResources::doLookupFont(char const*) const () from /lib/x86_64-linux-gnu/libpoppler.so.123
#5  0x00007f175f7609ad in GfxResources::lookupFont(char const*) () from /lib/x86_64-linux-gnu/libpoppler.so.123
#6  0x00007f175f746998 in Form::ensureFontsForAllCharacters(GooString const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, GfxResources*) () from /lib/x86_64-linux-gnu/libpoppler.so.123
[...]
#8  0x00007f175fb74d37 in Poppler::FormFieldText::setText(QString const&) () from /lib/x86_64-linux-gnu/libpoppler-qt5.so.1
[...]
#10 0x00007f17979022b5 in QUndoStack::push(QUndoCommand*) () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5
Comment 4 Riccardo Escher 2023-05-19 08:37:37 UTC
Created attachment 159092 [details]
New crash information added by DrKonqi

okular (23.04.0) using Qt 5.15.9

Same for me. A PDF Form already edited. Reopen it to add values into an empty form field: it crashes at the first character

-- Backtrace (Reduced):
#4  GfxResources::doLookupFont(char const*) const (this=<optimized out>, name=0x7ffff78e4750 "Helvetica") at /usr/src/debug/poppler-23.04.0/poppler/Gfx.cc:301
#5  0x00007f94093489ad in GfxResources::lookupFont(char const*) (this=<optimized out>, name=<optimized out>) at /usr/src/debug/poppler-23.04.0/poppler/Gfx.cc:313
#6  0x00007f9409342235 in Form::ensureFontsForAllCharacters(GooString const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, GfxResources*) (this=0x556bf2528460, unicodeText=0x556bf268e950, pdfFontNameToEmulate=<optimized out>, fieldResources=<optimized out>) at /usr/src/debug/poppler-23.04.0/poppler/Form.cc:2972
#7  0x00007f940933a056 in FormFieldText::setContentCopy(GooString const*) (this=0x556bf2508fa0, new_content=new_content@entry=0x556bf26598f0) at /usr/src/debug/poppler-23.04.0/poppler/Form.cc:1690
#8  0x00007f940933a2d5 in FormWidgetText::setContent(GooString const*) (this=this@entry=0x556bf2508ef0, new_content=new_content@entry=0x556bf26598f0) at /usr/src/debug/poppler-23.04.0/poppler/Form.cc:427
Comment 5 Sune Vuorela 2023-05-22 15:10:21 UTC
So, it looks like the form in question wants to use TimesNewRoman as font but that font is not embedded. At least for the pdf file attacheb by Sylvain. 

TimesNewRoman is not one of the 14 base fonts, though had it been, we would still have been crashing.

Poppler seems to expect that that should be the case.

I guess the following question is mostly for Albert:

Do we want to do the addFontToDefaultResources dance, or just ignore the concept of fonts in this case ?  I'm leaning towards adding the fonts to defaults and at the same time also, if it is one of the 14 base fonts, not actually embed the fonts, but only reference it.
Comment 6 Sune Vuorela 2023-05-22 19:45:58 UTC
Fixed in poppler in the next version, likely called 23.06.