Bug 328527 - KatePart crashes when loading a syntax highlighting XML fails
Summary: KatePart crashes when loading a syntax highlighting XML fails
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: part (show other bugs)
Version: unspecified
Platform: Fedora RPMs Linux
: NOR crash
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords: drkonqi
: 329030 335611 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-12-08 02:24 UTC by Kevin Kofler
Modified: 2014-11-09 14:04 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.13


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kevin Kofler 2013-12-08 02:24:24 UTC
Application: kwrite (4.10.5)
KDE Platform Version: 4.10.5
Qt Version: 4.8.5
Operating System: Linux 3.11.9-100.fc18.i686 i686
Distribution (Platform): Fedora RPMs

-- Information about the crash:
The KatePart crashes when loading a syntax highlighting XML fails due to invalid XML, or at least XML Qt THINKS is invalid (see https://bugreports.qt-project.org/browse/QTBUG-35459), instead of just disabling the offending syntax highlighting file.

- What I was doing when the application crashed:
1. I updated Qt to qt-4.8.5-12.fc18.i686 with the fix for CVE-2013-4549.
2. I created a dummy test.ly file (contents do not matter, it's only related to the highlighting scheme).
3. I started: kwrite test.ly, hitting the https://bugreports.qt-project.org/browse/QTBUG-35459 regression.
4. I got an error dialog:
"The error The XML entity "commands-other" expands too a string that is too large to process (2594 characters > 1024).
has been detected in the file /usr/share/kde4/apps/katepart/syntax/lilypond.xml at 15/56"
(The "expands too" misspelling is Qt's fault and already reported at https://bugreports.qt-project.org/browse/QTBUG-35460 .)
5. I got an information dialog:
"Since there has been an error parsing the highlighting description, this highlighting will be disabled"
6. At this point, KWrite crashed on me.

The crash can be reproduced every time.

-- Backtrace:
Application: KWrite (kwrite), signal: Segmentation fault
Using host libthread_db library "/lib/libthread_db.so.1".
[Current thread is 1 (Thread 0xb481e780 (LWP 8740))]

Thread 3 (Thread 0xb1244b40 (LWP 8741)):
#0  0xb7792424 in __kernel_vsyscall ()
#1  0xb5b1218c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#2  0xb189fa0d in QTWTF::TCMalloc_PageHeap::scavengerThread() () from /lib/libQtScript.so.4
#3  0xb189fa40 in QTWTF::TCMalloc_PageHeap::runScavengerThread(void*) () from /lib/libQtScript.so.4
#4  0xb5b0eaff in start_thread () from /lib/libpthread.so.0
#5  0xb58800ee in clone () from /lib/libc.so.6

Thread 2 (Thread 0xaf33ab40 (LWP 8742)):
#0  0xb7792424 in __kernel_vsyscall ()
#1  0xb5b1218c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#2  0xb5b8b608 in QWaitCondition::wait(QMutex*, unsigned long) () from /lib/libQtCore.so.4
#3  0xb1a0da7f in KLFKteLatexRunThread::run() () from /usr/lib/kde4/ktexteditor_klf.so
#4  0xb5b8b00a in QThreadPrivate::start(void*) () from /lib/libQtCore.so.4
#5  0xb5b0eaff in start_thread () from /lib/libpthread.so.0
#6  0xb58800ee in clone () from /lib/libc.so.6

Thread 1 (Thread 0xb481e780 (LWP 8740)):
[KCrash Handler]
#6  ref (this=0x0) at /usr/include/QtCore/qatomic_i386.h:120
#7  QString (other=..., this=0xbfd3c5cc) at /usr/include/QtCore/qstring.h:726
#8  hlKeyForAttrib (i=0, this=0x93c8a58) at /usr/src/debug/kate-4.10.5/part/syntax/katehighlight.cpp:1041
#9  KateHighlighting::getCommentStart (this=0x93c8a58, attrib=0) at /usr/src/debug/kate-4.10.5/part/syntax/katehighlight.cpp:1081
#10 0xb15c255f in KateView::slotHlChanged (this=0xb15c5f68 <KateView::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)+3128>) at /usr/src/debug/kate-4.10.5/part/view/kateview.cpp:1836
#11 0xbfd3c738 in ?? ()

Possible duplicates by query: bug 323278.

Reported using DrKonqi
Comment 1 Michal Humpula 2013-12-11 16:17:27 UTC
Hi Kevin,

you might try to recompile with this patch https://git.reviewboard.kde.org/r/114374/.
Comment 2 Michal Humpula 2013-12-14 16:07:58 UTC
Git commit 44beb7d342309f524e91ab18c9827e83225e36de by Michal Humpula.
Committed on 09/12/2013 at 22:50.
Pushed by michalhumpula into branch 'master'.

bugfix: when fail to load highlight don't crash

REVIEW: 114374

M  +14   -6    part/syntax/katehighlight.cpp
M  +2    -0    part/syntax/katehighlight.h

http://commits.kde.org/kate/44beb7d342309f524e91ab18c9827e83225e36de
Comment 3 Michal Humpula 2013-12-20 18:45:40 UTC
*** Bug 329030 has been marked as a duplicate of this bug. ***
Comment 4 Jaehoo 2014-03-09 22:44:08 UTC
I get this every time I select Tools > Highlighting > Errors! > ...lilypond.xml. Problem is I have no idea how to recompile and/or patch anything (at least not yet. Still have loads to learn), so, yeah... is there a simple way to apply Michal's solution?
Comment 5 Kevin Kofler 2014-03-10 01:18:19 UTC
Try to get your distro to apply this Qt patch:
http://pkgs.fedoraproject.org/cgit/qt.git/tree/qt-everywhere-opensource-src-4.8.5-QTBUG-35459.patch
(or if they think 65536 is too large a limit, then they should set it to 3000 or something, but 1024 is not enough).

If they don't want to do that, get them to at least apply the Kate patch so that Kate won't crash (but it will still not be able to load the Lilypond syntax definition without the Qt patch).
Comment 6 Michal Humpula 2014-03-10 05:44:01 UTC
Hi Jaehoo,

you can find modified lylipond.xml file here:
http://quickgit.kde.org/?p=kate.git&a=blob&h=b1794502d1a1b862a42efb03f0114296a47f36c6&f=part/syntax/data/lilypond.xml&o=plain

Just download it and move it to the location of syntax files. In regular install that should be the /usr/share/kde4/apps/katepart/syntax/ directory.
Comment 7 Christoph Feck 2014-06-22 17:04:44 UTC
*** Bug 335611 has been marked as a duplicate of this bug. ***
Comment 8 Dominik Haumann 2014-11-09 14:04:39 UTC
Git commit a94599efed72cc2bedd8fe7f2b281a669a12ed4b by Dominik Haumann, on behalf of Michal Humpula.
Committed on 09/12/2013 at 22:50.
Pushed by dhaumann into branch 'KDE/4.12'.

bugfix: when fail to load highlight don't crash

REVIEW: 114374

M  +14   -6    part/syntax/katehighlight.cpp
M  +2    -0    part/syntax/katehighlight.h

http://commits.kde.org/kate/a94599efed72cc2bedd8fe7f2b281a669a12ed4b