Bug 466425 - Okular crashes when opening a faulty file
Summary: Okular crashes when opening a faulty file
Status: CONFIRMED
Alias: None
Product: okular
Classification: Applications
Component: EPub backend (show other bugs)
Version: 22.12.2
Platform: Other Linux
: NOR crash
Target Milestone: ---
Assignee: aronkvh
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-02-25 18:52 UTC by aronkvh
Modified: 2023-04-13 17:59 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
faulty file (243.34 KB, application/xml)
2023-03-19 17:19 UTC, aronkvh
Details
faultyfile_fixed (243.34 KB, application/epub+zip)
2023-03-20 18:44 UTC, aronkvh
Details

Note You need to log in before you can comment on or make changes to this bug.
Description aronkvh 2023-02-25 18:52:22 UTC
I've received an .epub file in email and when I try to open it Okular crashes every time. I thought the file might be corrupt, a validator website says so. Still, it'd be nice to receive an error telling me that the file is probably corrupt and that's why it can't be opened. 

Unable to open QuickAnnotatingTools XML definition
KCrash: crashing... crashRecursionCounter = 2
KCrash: Application Name = okular path = /usr/bin pid = 29212
KCrash: Arguments: /usr/bin/okular /home/aronkvh/Downloads/Lánytörténet - Annie Ernaux.epub 
KCrash: Attempting to start /usr/lib/x86_64-linux-gnu/libexec/drkonqi
Comment 1 Albert Astals Cid 2023-02-28 23:50:11 UTC
Please give us the faulty file :)
Comment 2 Bug Janitor Service 2023-03-15 03:45:42 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 3 aronkvh 2023-03-19 17:19:35 UTC
Created attachment 157421 [details]
faulty file
Comment 4 aronkvh 2023-03-20 18:44:42 UTC
Created attachment 157452 [details]
faultyfile_fixed
Comment 5 Dave Gilbert 2023-04-13 15:56:13 UTC
#0  __strcmp_avx2 () at ../sysdeps/x86_64/multiarch/strcmp-avx2.S:287
#1  0x00007fffd02f5068 in FindNode (List=0x10f4490, Data=Data@entry=0x7fffffffbe30)
    at /usr/src/debug/ebook-tools-0.2.2-23.fc37.x86_64/src/libepub/linklist.c:116
        Compare = <optimized out>
#2  0x00007fffd02f5239 in _opf_manifest_get_by_id (opf=<optimized out>, id=<optimized out>)
    at /usr/src/debug/ebook-tools-0.2.2-23.fc37.x86_64/src/libepub/opf.c:767
        data = {nspace = 0x7fffffffbe50 "", modules = 0xfffffffffffffed0 <error: Cannot access memory at address 0xfffffffffffffed0>, id = 0x0, href = 0x0, type = 0x0, fallback = 0x7fffe0c90526 <Okular::Document::notice(QString const&, int)> "UH\211\345H\203\354@H\211}\330H\211uЉU\314f\017\357\300\017)E\340f\017\326E\360H\213E\320H\211\307\350\353,", fbStyle = 0x0}
#3  0x00007fffd02f528e in _get_spine_it_url (it=it@entry=0x10f4350)
    at /usr/src/debug/ebook-tools-0.2.2-23.fc37.x86_64/src/libepub/epub.c:258
        tmp = <optimized out>
        data = 0x10ea070
#4  0x00007fffd02f5322 in epub_it_get_curr (it=0x10f4350)
    at /usr/src/debug/ebook-tools-0.2.2-23.fc37.x86_64/src/libepub/epub.c:343
#5  0x00007fffd232478a in Epub::Converter::convert(QString const&) (this=0x10d1450, fileName=...)
    at /discs/more/git/okular/generators/epub/converter.cpp:360
        newDocument = 0x10d5530
        _cursor = 0x10d6420
        it = 0x10f4350
        firstPage = false
        movieAnnots = {d = 0x7ffff5f6d240 <QArrayData::shared_null>}
        soundActions = {d = 0x7ffff5f6d240 <QArrayData::shared_null>}
        orig = {d = 0x9558c0, {data = {current_group = 0, resolve_mask = 1965951}, for_faster_swapping_dont_use = 31455216}}
        p = {d = 0x10c9580, {data = {current_group = 0, resolve_mask = 1965951}, for_faster_swapping_dont_use = 31455216}}
        videoSize = {wd = 320, ht = 240}
        __PRETTY_FUNCTION__ = "virtual QTextDocument* Epub::Converter::convert(const QString&)"
        tit = 0xff
        hit = {c = {{d = 0x10d28c8, e = 0x10d28c8}}, i = {i = 0x7ffff7fd85a2 <_dl_fixup+258>}, n = {i = 0x5}}
#6  0x00007fffe0d2478a in Okular::TextDocumentConverter::convertWithPassword(QString const&, QString const&)
    (this=0x10d1450, fileName=...) at /discs/more/git/okular/core/textdocumentgenerator.cpp:52
        doc = 0x10d6cb0
#7  0x00007fffe0d25890 in Okular::TextDocumentGenerator::loadDocumentWithPassword(QString const&, QVector<Okular::Page*>&, QString const&) (this=0x10d6cb0, fileName=..., pagesVector=..., password=...)
    at /discs/more/git/okular/core/textdocumentgenerator.cpp:288
        d = 0x98c0c0
        openResult = Okular::Document::OpenSuccess
        linkInfos = {<QListSpecialMethods<Okular::TextDocumentGeneratorPrivate::LinkInfo>> = {<No data fields>}, {p = {static shared_null = {ref = {atomic = {_q_value = std::atomic<int> = { -1 }}}, alloc = 0, begin = 0, end = 0, array = {0x0}}, d = 0x7fffffffc860}, d = 0x7fffffffc860}}
        annotationInfos = {<QListSpecialMethods<Okular::TextDocumentGeneratorPrivate::AnnotationInfo>> = {<No data fields>}, {p = {static shared_null = {ref = {atomic = {_q_value = std::atomic<int> = { -1 }}}, alloc = 0, begin = 0, end = 0, array = {0x0}}, d = 0x7fffffffc858}, d = 0x7fffffffc858}}
        size = {wd = 566784540, ht = 1080302727}
        objects = {d = 0x7fffffffc9c0}
        annots = {d = 0x10c97e0}
#8  0x00007fffe0cc659e in Okular::DocumentPrivate::openDocumentInternal(KPluginMetaData const&, bool, QString const&, QByteArray const&, QString const&)
    (this=0x7465c0, offer=..., isstdin=false, docFile=..., filedata=..., password=...)
    at /discs/more/git/okular/core/document.cpp:943
        propName = {d = 0x10d0c60}
        genIt = {i = 0x10da870}
        errorToOpenErrorConnection = {d_ptr = 0x10d1720}
        window = 0xe58a70
        dpi = {wd = 157.06280193236714, ht = 160.89149560117301}
        __PRETTY_FUNCTION__ = "Okular::Document::OpenResult Okular::DocumentPrivate::openDocumentInternal(const KPluginMetaData&, bool, const QString&, const QByteArray&, const QString&)"
        openResult = Okular::Document::OpenError
#9  0x00007fffe0cd00c7 in Okular::Document::openDocument(QString const&, QUrl const&, QMimeType const&, QString const&) (this=0x7e08e0, docFile=..., url=..., _mime=..., password=...) at /discs/more/git/okular/core/document.cpp:2461
        db = {d = 0x7ffff616b380 <(anonymous namespace)::Q_QGS_staticQMimeDatabase::innerFunction()::holder>}
        mime = {d = {d = 0x10d1150}}
        filedata = {d = 0x7ffff5f6d240 <QArrayData::shared_null>}
        fd = -1
        triedMimeFromFileContent = false
        __PRETTY_FUNCTION__ = "Okular::Document::OpenResult Okular::Document::openDocument(const QString&, const QUrl&, const QMimeType&, const QString&)"
        fromFileDescriptor = false
        offer = {m_metaData = {dead = 0x0, o = {d = 0xac9dd0}}, m_fileName = {d = 0xa89bc0}, d = {d = 0xab5720}}
        openResult = (Okular::Document::OpenError | Okular::Document::OpenNeedsPassword | unknown: 0x7ffc)
        loadedViewport = {pageNumber = -523961464, rePos = {enabled = 250, normalizedX = 1.2461174142536628e-306, normalizedY = 6.9533558072168294e-310, pos = (unknown: 0xffffd0f0)}, autoFit = {enabled = 32, width = 214, height = 255}}
        nextViewport = {pageNumber = 7059808, rePos = {enabled = 16, normalizedX = 6.9533558073049707e-310, normalizedY = 6.9533491685746303e-310, pos = (Okular::DocumentViewport::Center | unknown: 0x4)}, autoFit = {enabled = false, width = false, height = false}}
        docScripts = {<QList<QString>> = {<QListSpecialMethods<QString>> = {<No data fields>}, {p = {static shared_null = {ref = {atomic = {_q_value = std::atomic<int> = { -1 }}}, alloc = 0, begin = 0, end = 0, array = {0x0}}, d = 0x7fffe10b7a00 <Okular::Document::openDocument(QString const&, QUrl const&, QMimeType const&, QString const&)@got.plt>}, d = 0x7fffe10b7a00 <Okular::Document::openDocument(QString const&, QUrl const&, QMimeType const&, QString const&)@got.plt>}}, <No data fields>}
#10 0x00007fffe0ed1b16 in Okular::Part::doOpenFile(QMimeType const&, QString const&, bool*)
    (this=0x68d820, mimeA=..., fileNameToOpenA=..., isCompressedFile=0x7fffffffd187)
    at /discs/more/git/okular/part/part.cpp:1459
        walletName = {d = 0x7ffff616b380 <(anonymous namespace)::Q_QGS_staticQMimeDatabase::innerFunction()::holder>}
        firstInput = 255
        triedWallet = 214
        walletFolder = {d = 0x0}
        walletKey = {d = 0x0}
        wallet = 0x10d0d60
        keep = false
        db = {d = 0x7ffff616b380 <(anonymous namespace)::Q_QGS_staticQMimeDatabase::innerFunction()::holder>}
        openResult = Okular::Document::OpenError
        uncompressOk = true
        mime = {d = {d = 0x10d1150}}
        fileNameToOpen = {d = 0x10cd190}
        compressionType = KCompressionDevice::None
        mimes = {<QListSpecialMethods<QMimeType>> = {<No data fields>}, {p = {static shared_null = {ref = {atomic = {_q_value = std::atomic<int> = { -1 }}}, alloc = 0, begin = 0, end = 0, array = {0x0}}, d = 0x10d1390}, d = 0x10d1390}}
        fileNameToOpen = {d = 0x10cd190}
--Type <RET> for more, q to quit, c to continue without paging--
        isstdin = false
        fileInfo = {d_ptr = {d = 0x10c1c30}}
        db = {d = 0x7ffff616b380 <(anonymous namespace)::Q_QGS_staticQMimeDatabase::innerFunction()::holder>}
        pathMime = {d = {d = 0x10d0d20}}
        mime = {d = {d = 0x10d1150}}
        openResult = Okular::Document::OpenError
        isCompressedFile = false
        canSearch = 214
        ok = 16
        hasEmbeddedFiles = false
        presentationBecauseOfDocumentMetadata = false
#12 0x00007ffff7f686a5 in KParts::ReadOnlyPartPrivate::openLocalFile() (this=this@entry=0x6bb8b0)
    at /usr/src/debug/kf5-kparts-5.104.0-1.fc37.x86_64/src/readonlypart.cpp:184
        q = 0x68d820
        ret = <optimized out>
#13 0x00007ffff7f6cebf in KParts::ReadOnlyPart::openUrl(QUrl const&) (this=<optimized out>, url=...)
    at /usr/src/debug/kf5-kparts-5.104.0-1.fc37.x86_64/src/readonlypart.cpp:145
        d = 0x6bb8b0
        args = {d = {d = 0x10d12e0}}
        closed = true
#14 0x00007fffe0ed4856 in Okular::Part::openUrl(QUrl const&, bool)
    (this=0x68d820, _url=..., swapInsteadOfOpening=false) at /discs/more/git/okular/part/part.cpp:1819
        args = {d = {d = 0x70d3b0}}
        url = {d = 0x10cd130}
        openOk = true
#15 0x00007fffe0ed440a in Okular::Part::openUrl(QUrl const&) (this=0x68d820, url=...)
    at /discs/more/git/okular/part/part.cpp:1767
#16 0x000000000041d972 in Shell::openUrl(QUrl const&, QString const&)
    (this=0x60df00, url=..., serializedOptions=...) at /discs/more/git/okular/shell/shell.cpp:416
        openOk = false
        isstdin = false
        activePart = 0x68d820
        activeTab = 0
#17 0x000000000041d4d0 in Shell::openDocument(QUrl const&, QString const&)
    (this=0x60df00, url=..., serializedOptions=...) at /discs/more/git/okular/shell/shell.cpp:360
        part = 0x68d820
#18 0x000000000041927c in Okular::main(QStringList const&, QString const&) (paths=..., serializedOptions=...)
    at /discs/more/git/okular/shell/okular_main.cpp:213
        page = {d = 0x7ffff5f6d1e0 <qt_array>}
        url = {d = 0x10cd130}
        i = 0
        shell = 0x60df00
#19 0x00000000004164e8 in main(int, char**) (argc=2, argv=0x7fffffffde28)
    at /discs/more/git/okular/shell/main.cpp:97
        paths = {<QList<QString>> = {<QListSpecialMethods<QString>> = {<No data fields>}, {p = {static shared_null = {ref = {atomic = {_q_value = std::atomic<int> = { -1 }}}, alloc = 0, begin = 0, end = 0, array = {0x0}}, d = 0x7564b0}, d = 0x7564b0}}, <No data fields>}
        status = (unknown: 0xf8fdd800)
        app = {<QGuiApplication> = {<QCoreApplication> = {<QObject> = {_vptr.QObject = 0x7ffff70d5428 <vtable for QApplication+16>, static staticMetaObject = {d = {superdata = {direct = 0x0}, stringdata = 0x7ffff60518c0 <qt_meta_stringdata_QObject>, data = 0x7ffff60517a0 <qt_meta_data_QObject>, static_metacall = 0x7ffff5ece330 <QObject::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}, d_ptr = {d = 0x46fb50}, static staticQtMetaObject = {d = {superdata = {direct = 0x0}, stringdata = 0x7ffff6054860 <qt_meta_stringdata_Qt>,--Type <RET> for more, q to quit, c to continue without paging--
 data = 0x7ffff60519e0 <qt_meta_data_Qt>, static_metacall = 0x0, relatedMetaObjects = 0x0, extradata = 0x0}}}, static staticMetaObject = {d = {superdata = {direct = 0x7ffff61553e0 <QObject::staticMetaObject>}, stringdata = 0x7ffff604bd40 <qt_meta_stringdata_QCoreApplication>, data = 0x7ffff604bc20 <qt_meta_data_QCoreApplication>, static_metacall = 0x7ffff5e9ed90 <QCoreApplication::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}, static self = 0x7fffffffdab0}, static staticMetaObject = {d = {superdata = {direct = 0x7ffff615dd00 <QCoreApplication::staticMetaObject>}, stringdata = 0x7ffff6718600 <qt_meta_stringdata_QGuiApplication>, data = 0x7ffff6718380 <qt_meta_data_QGuiApplication>, static_metacall = 0x7ffff6360ae0 <QGuiApplication::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}}, static staticMetaObject = {d = {superdata = {direct = 0x7ffff6819b40 <QGuiApplication::staticMetaObject>}, stringdata = 0x7ffff6f6e8c0 <qt_meta_stringdata_QApplication>, data = 0x7ffff6f6e740 <qt_meta_data_QApplication>, static_metacall = 0x7ffff6bb28e0 <QApplication::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}}
        aboutData = {d = std::unique_ptr<KAboutDataPrivate> = {get() = 0x6de4e0}}
        parser = {d = 0x6e80e0}
Comment 6 Dave Gilbert 2023-04-13 16:50:04 UTC
The 'einfo' program that uses the same library crashes in the same way, so I'm guessing it's the library.

[dg@dalek build]$ gdb /usr/bin/einfo
....
(gdb) r -p ~/bugs/okular-466425-epubcrash/faulty_file.epub                                                                                     
...

Program received signal SIGSEGV, Segmentation fault.
__strcmp_avx2 () at ../sysdeps/x86_64/multiarch/strcmp-avx2.S:287
287             CMP_R1_S2_ymm (%ymm0, (%rsi), %ymm2, %ymm1)                                                                                    
(gdb) where
#0  __strcmp_avx2 () at ../sysdeps/x86_64/multiarch/strcmp-avx2.S:287
#1  0x00007ffff7f94068 in FindNode (List=0x55555555f9a0, Data=Data@entry=0x7fffffffdc40)
    at /usr/src/debug/ebook-tools-0.2.2-23.fc37.x86_64/src/libepub/linklist.c:116
#2  0x00007ffff7f94239 in _opf_manifest_get_by_id (opf=<optimized out>, id=<optimized out>)
    at /usr/src/debug/ebook-tools-0.2.2-23.fc37.x86_64/src/libepub/opf.c:767
#3  0x00007ffff7f9428e in _get_spine_it_url (it=it@entry=0x55555555fc40)
    at /usr/src/debug/ebook-tools-0.2.2-23.fc37.x86_64/src/libepub/epub.c:258
#4  0x00007ffff7f94322 in epub_it_get_curr (it=0x55555555fc40) at /usr/src/debug/ebook-tools-0.2.2-23.fc37.x86_64/src/libepub/epub.c:343
#5  0x0000555555555357 in main (argc=<optimized out>, argv=0x7fffffffde28)
    at /usr/src/debug/ebook-tools-0.2.2-23.fc37.x86_64/src/tools/einfo.c:122
Comment 7 Dave Gilbert 2023-04-13 17:59:38 UTC
This seems to be fixed by the set of fixes in:
https://github.com/captn3m0/ebook-tools

referenced from:
https://sourceforge.net/p/ebook-tools/bugs/10/

heck, this library is old; it seems worth taking those fixes somehow, not sure how.
Anyway, erm what do we do with this Okular bug?