Created attachment 141978 [details] test SUMMARY Okular crashes when opening a markdown file that contains an embedded image without alt text. This happens using when the file contains something like: ![](/path/to/img.jpg) But not with: ![Alt text](/path/to/img.jpg) Though, the image is not displayed anyway, only the alt text. STEPS TO REPRODUCE 1. create a test.md file containing: ![](https://kde.org/stuff/clipart/logo/kde-logo-white-blue-rounded-128x128.png) 2. Open the file in okular OBSERVED RESULT Okular doesn't open. Journal shows: Process 12264 (okular) of user 1000 dumped core. EXPECTED RESULT Okular opens and shows the file. SOFTWARE/OS VERSIONS Operating System: Arch Linux KDE Plasma Version: 5.22.5 KDE Frameworks Version: 5.86.0 Qt Version: 5.15.2 ADDITIONAL INFORMATION Try opening the attached test file.
When I tried to open the test file in okular, it didn't core dump, but it didn't render the file and the journal received the following message many times per second: okular[8912]: QTextCursor::setPosition: Position '1' out of range
It would be useful to have the stack trace from the crash, but then ArchLinux doesn't make it easy as far as I know. I can reproduce it on Okular 21.08.1, libmarkdown2 2.2.7, and I get the following backtrace: [KCrash Handler] #4 0x00007f1a84531b93 in QTextBlock::iterator::operator++() () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5 #5 0x00007f1a750823a3 in ?? () from /usr/lib/x86_64-linux-gnu/qt5/plugins/okular/generators/okularGenerator_md.so #6 0x00007f1a750828a5 in ?? () from /usr/lib/x86_64-linux-gnu/qt5/plugins/okular/generators/okularGenerator_md.so #7 0x00007f1a75082a08 in ?? () from /usr/lib/x86_64-linux-gnu/qt5/plugins/okular/generators/okularGenerator_md.so #8 0x00007f1a75082c01 in ?? () from /usr/lib/x86_64-linux-gnu/qt5/plugins/okular/generators/okularGenerator_md.so #9 0x00007f1a7c43ccab in Okular::TextDocumentGenerator::loadDocumentWithPassword(QString const&, QVector<Okular::Page*>&, QString const&) () from /usr/lib/x86_64-linux-gnu/libOkular5Core.so.9 #10 0x00007f1a7c41c4ae in ?? () from /usr/lib/x86_64-linux-gnu/libOkular5Core.so.9 #11 0x00007f1a7c41cb91 in Okular::Document::openDocument(QString const&, QUrl const&, QMimeType const&, QString const&) () from /usr/lib/x86_64-linux-gnu/libOkular5Core.so.9 #12 0x00007f1a7c5aa535 in Okular::Part::doOpenFile(QMimeType const&, QString const&, bool*) () from /usr/lib/x86_64-linux-gnu/qt5/plugins/okularpart.so #13 0x00007f1a7c5ab2bb in Okular::Part::openFile() () from /usr/lib/x86_64-linux-gnu/qt5/plugins/okularpart.so #14 0x00007f1a856ba505 in ?? () from /usr/lib/x86_64-linux-gnu/libKF5Parts.so.5 #15 0x00007f1a856bb5de in KParts::ReadOnlyPart::openUrl(QUrl const&) () from /usr/lib/x86_64-linux-gnu/libKF5Parts.so.5 #16 0x00007f1a7c59bbf3 in Okular::Part::openUrl(QUrl const&, bool) () from /usr/lib/x86_64-linux-gnu/qt5/plugins/okularpart.so [...] Which version of libmarkdown do you both have?
libmarkdown2 version 2.2.6-1 from ubuntu focal repository Operating System: KDE neon 5.22 KDE Plasma Version: 5.22.5 KDE Frameworks Version: 5.86.0 Qt Version: 5.15.3 Kernel Version: 5.11.0-36-generic (64-bit) Graphics Platform: X11 Processors: 2 × AMD A6-6400K APU with Radeon(tm) HD Graphics Memory: 7.7 GiB of RAM Graphics Processor: AMD CEDAR
/usr/lib/libmarkdown.so is owned by discount 2.2.7-1
A possibly relevant merge request was started @ https://invent.kde.org/graphics/okular/-/merge_requests/490
A possibly relevant merge request was started @ https://invent.kde.org/graphics/okular/-/merge_requests/491
Git commit 3b8cbc33204be4a88df56150078d42149b0dc6cf by Albert Astals Cid. Committed on 29/09/2021 at 07:47. Pushed by aacid into branch 'master'. markdown: Only remove text if we're going to add something Otherwise things get confused M +2 -1 generators/markdown/converter.cpp https://invent.kde.org/graphics/okular/commit/3b8cbc33204be4a88df56150078d42149b0dc6cf
Git commit bbc775909cb0e224d0a1ef38663add2bf9c91721 by Albert Astals Cid. Committed on 29/09/2021 at 16:23. Pushed by aacid into branch 'release/21.08'. markdown: Only remove text if we're going to add something Otherwise things get confused (cherry picked from commit 3b8cbc33204be4a88df56150078d42149b0dc6cf) M +2 -1 generators/markdown/converter.cpp https://invent.kde.org/graphics/okular/commit/bbc775909cb0e224d0a1ef38663add2bf9c91721