Bug 314284

Summary: Words crashes on export to Mobipocket
Product: [Applications] calligrawords Reporter: Friedrich W. H. Kossebau <kossebau>
Component: filtersAssignee: Calligra Words Bugs <calligra-words-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: inge
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Friedrich W. H. Kossebau 2013-02-02 06:28:37 UTC
Application: calligrawords (2.7 Pre-Alpha)
KDE Platform Version: 4.8.5 (4.8.5) "release 2"
Qt Version: 4.8.1
Operating System: Linux 3.4.11-2.16-desktop x86_64
Distribution: "openSUSE 12.2 (x86_64)"

-- Information about the crash:
1. Started Words
2. Created new document from Blank Document template
3. Export as Mobipocket file
*Boom*

Also when compiling I see these warnings:
/home/koder/Kode/kdegit/Calligra/calligra/filters/words/mobi/PalmDocCompression.cpp: In member function ‘void PalmDocCompression::startCompressing(QByteArray, QDataStream&, QList<int>&)’:
/home/koder/Kode/kdegit/Calligra/calligra/filters/words/mobi/PalmDocCompression.cpp:133:77: warning: comparison is always true due to limited range of data type [-Wtype-limits]
/home/koder/Kode/kdegit/Calligra/calligra/filters/words/mobi/PalmDocCompression.cpp:145:63: warning: comparison is always false due to limited range of data type [-Wtype-limits]
/home/koder/Kode/kdegit/Calligra/calligra/filters/words/mobi/PalmDocCompression.cpp:152:68: warning: comparison is always false due to limited range of data type [-Wtype-limits]

And looking at the code I wonder:
Why convert fromLatin1 to a QChar and then back again, using QChar(input.at(index)).toLatin1()? input.at(index) should be enough, no?
And the code seems to miss that char is usually signed char, so values are from -128..127. The hex values used in the code might be the byte values as unsigned values, at least e.g. "QChar(input.at(index)).toLatin1() > (qint8)0X7f" hints as that, because 0x7f is 127.
workaround might be either to use a char literal encoding like '\x7f' or use a reinterpret_cast<unsigned char>(input.at(index))

The crash can be reproduced every time.

-- Backtrace:
Application: Calligra Words (calligrawords), signal: Aborted
Using host libthread_db library "/lib64/libthread_db.so.1".
[Current thread is 1 (Thread 0x7fd5a40c2780 (LWP 30215))]

Thread 2 (Thread 0x7fd5845b4700 (LWP 30216)):
#0  0x00007fd59cfd614f in poll () from /lib64/libc.so.6
#1  0x00007fd5965a0684 in ?? () from /usr/lib64/libglib-2.0.so.0
#2  0x00007fd5965a07a4 in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#3  0x00007fd59de78956 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQtCore.so.4
#4  0x00007fd59de4973f in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQtCore.so.4
#5  0x00007fd59de499c8 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQtCore.so.4
#6  0x00007fd59dd4de40 in QThread::exec() () from /usr/lib64/libQtCore.so.4
#7  0x00007fd59de2a11f in ?? () from /usr/lib64/libQtCore.so.4
#8  0x00007fd59dd50ddb in ?? () from /usr/lib64/libQtCore.so.4
#9  0x00007fd59dabae0e in start_thread () from /lib64/libpthread.so.0
#10 0x00007fd59cfde2cd in clone () from /lib64/libc.so.6

Thread 1 (Thread 0x7fd5a40c2780 (LWP 30215)):
[KCrash Handler]
#5  0x00007fd59cf2ed25 in raise () from /lib64/libc.so.6
#6  0x00007fd59cf301a8 in abort () from /lib64/libc.so.6
#7  0x00007fd59dd469a4 in qt_message_output(QtMsgType, char const*) () from /usr/lib64/libQtCore.so.4
#8  0x00007fd59dd46b58 in ?? () from /usr/lib64/libQtCore.so.4
#9  0x00007fd59dd46ce4 in qFatal(char const*, ...) () from /usr/lib64/libQtCore.so.4
#10 0x00007fd59dd46d2a in qt_assert(char const*, char const*, int) () from /usr/lib64/libQtCore.so.4
#11 0x00007fd573538a74 in QByteArray::at (this=0x7fffbdcdbe80, i=158) at /usr/include/QtCore/qbytearray.h:414
#12 0x00007fd5735387c2 in PalmDocCompression::startCompressing (this=0x7fffbdcdbff0, input=..., out=..., recordOffset=...) at /home/koder/Kode/kdegit/Calligra/calligra/filters/words/mobi/PalmDocCompression.cpp:220
#13 0x00007fd573538201 in PalmDocCompression::compressContent (this=0x7fffbdcdbff0, input=..., output=..., recordOffset=...) at /home/koder/Kode/kdegit/Calligra/calligra/filters/words/mobi/PalmDocCompression.cpp:93
#14 0x00007fd573531741 in ExportMobi::convert (this=0x16b76f0, from=..., to=...) at /home/koder/Kode/kdegit/Calligra/calligra/filters/words/mobi/exportmobi.cpp:131
#15 0x00007fd5a39933bc in CalligraFilter::ChainLink::invokeFilter (this=0x3154b00, parentChainLink=0x0) at /home/koder/Kode/kdegit/Calligra/calligra/libs/main/KoFilterChainLink.cpp:90
#16 0x00007fd5a3989e2e in KoFilterChain::invokeChain (this=0x1500a60) at /home/koder/Kode/kdegit/Calligra/calligra/libs/main/KoFilterChain.cpp:95
#17 0x00007fd5a39829c0 in KoFilterManager::exportDocument (this=0x36fb810, url=..., mimeType=...) at /home/koder/Kode/kdegit/Calligra/calligra/libs/main/KoFilterManager.cpp:243
#18 0x00007fd5a390fe96 in KoDocument::saveFile (this=0x117e930) at /home/koder/Kode/kdegit/Calligra/calligra/libs/main/KoDocument.cpp:340
#19 0x00007fd5a39cdfd2 in KoPart::saveFile (this=0x1264810) at /home/koder/Kode/kdegit/Calligra/calligra/libs/main/KoPart.cpp:205
#20 0x00007fd5a2e2e20c in KParts::ReadWritePart::save() () from /usr/lib64/libkparts.so.4
#21 0x00007fd5a2e2d5e1 in KParts::ReadWritePart::saveAs(KUrl const&) () from /usr/lib64/libkparts.so.4
#22 0x00007fd5a390f335 in KoDocument::exportDocument (this=0x117e930, _url=...) at /home/koder/Kode/kdegit/Calligra/calligra/libs/main/KoDocument.cpp:267
#23 0x00007fd5a39463ae in KoMainWindow::saveDocument (this=0x1137860, saveas=true, silent=false) at /home/koder/Kode/kdegit/Calligra/calligra/libs/main/KoMainWindow.cpp:1053
#24 0x00007fd5a394831a in KoMainWindow::slotFileSaveAs (this=0x1137860) at /home/koder/Kode/kdegit/Calligra/calligra/libs/main/KoMainWindow.cpp:1322
#25 0x00007fd5a394c42b in KoMainWindow::slotExportFile (this=0x1137860) at /home/koder/Kode/kdegit/Calligra/calligra/libs/main/KoMainWindow.cpp:1881
#26 0x00007fd5a394dba4 in KoMainWindow::qt_static_metacall (_o=0x1137860, _c=QMetaObject::InvokeMetaMethod, _id=26, _a=0x7fffbdcdd170) at /home/koder/Kode/kdegit/Calligra/build.debug/calligra/libs/main/KoMainWindow.moc:138
#27 0x00007fd59de60f5f in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib64/libQtCore.so.4
#28 0x00007fd59ed18522 in QAction::triggered(bool) () from /usr/lib64/libQtGui.so.4
#29 0x00007fd59ed18710 in QAction::activate(QAction::ActionEvent) () from /usr/lib64/libQtGui.so.4
#30 0x00007fd59f1513d3 in ?? () from /usr/lib64/libQtGui.so.4
#31 0x00007fd59f1576e9 in ?? () from /usr/lib64/libQtGui.so.4
#32 0x00007fd59faeafd0 in KMenu::mouseReleaseEvent(QMouseEvent*) () from /usr/lib64/libkdeui.so.5
#33 0x00007fd59ed6de60 in QWidget::event(QEvent*) () from /usr/lib64/libQtGui.so.4
#34 0x00007fd59f15899b in QMenu::event(QEvent*) () from /usr/lib64/libQtGui.so.4
#35 0x00007fd59ed1e74c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib64/libQtGui.so.4
#36 0x00007fd59ed234db in QApplication::notify(QObject*, QEvent*) () from /usr/lib64/libQtGui.so.4
#37 0x00007fd5a390bc6e in KoApplication::notify (this=0x7fffbdcde8d0, receiver=0x11b09c0, event=0x7fffbdcddd50) at /home/koder/Kode/kdegit/Calligra/calligra/libs/main/KoApplication.cpp:555
#38 0x00007fd59de4a73e in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib64/libQtCore.so.4
#39 0x00007fd59ed1f58b in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) () from /usr/lib64/libQtGui.so.4
#40 0x00007fd59ed99a9c in ?? () from /usr/lib64/libQtGui.so.4
#41 0x00007fd59ed98961 in QApplication::x11ProcessEvent(_XEvent*) () from /usr/lib64/libQtGui.so.4
#42 0x00007fd59edbec32 in ?? () from /usr/lib64/libQtGui.so.4
#43 0x00007fd5965a03b5 in g_main_context_dispatch () from /usr/lib64/libglib-2.0.so.0
#44 0x00007fd5965a06e8 in ?? () from /usr/lib64/libglib-2.0.so.0
#45 0x00007fd5965a07a4 in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#46 0x00007fd59de78936 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQtCore.so.4
#47 0x00007fd59edbe8ae in ?? () from /usr/lib64/libQtGui.so.4
#48 0x00007fd59de4973f in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQtCore.so.4
#49 0x00007fd59de499c8 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQtCore.so.4
#50 0x00007fd59de4e3a8 in QCoreApplication::exec() () from /usr/lib64/libQtCore.so.4
#51 0x00007fd5a3cc641c in kdemain (argc=1, argv=0x7fffbdcdeab8) at /home/koder/Kode/kdegit/Calligra/calligra/words/part/main.cpp:43
#52 0x0000000000400a4e in main (argc=1, argv=0x7fffbdcdeab8) at /home/koder/Kode/kdegit/Calligra/build.debug/calligra/words/part/calligrawords_dummy.cpp:3

Reported using DrKonqi
Comment 1 Friedrich W. H. Kossebau 2013-02-02 14:13:51 UTC
Git commit f9c545e2e14e56f109117a19575db3c125c351d9 by Friedrich W. H. Kossebau.
Committed on 02/02/2013 at 15:13.
Pushed by kossebau into branch 'calligra/2.6'.

Disable mobipocket export filter, crashes all the time

CCMAIL: mojtaba.shahi3000@gmail.com

M  +2    -1    filters/words/CMakeLists.txt

http://commits.kde.org/calligra/f9c545e2e14e56f109117a19575db3c125c351d9
Comment 2 Inge Wallin 2013-02-04 15:25:41 UTC
Fixed now.