Summary: | [TESTCASE] Crash after consuming all memory | ||
---|---|---|---|
Product: | [Applications] kate | Reporter: | Valery Yundin <yu.valery+bugzilla> |
Component: | part | Assignee: | KWrite Developers <kwrite-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | crash | CC: | awen, bill, g2spot |
Priority: | VHI | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | openSUSE | ||
OS: | Linux | ||
Latest Commit: | http://commits.kde.org/kate/5e5cf873b55e84a76d6425f96db0a8d4ee513507 | Version Fixed In: | |
Sentry Crash Report: | |||
Attachments: |
Crash testcase
Patch fixing the issue |
Description
Valery Yundin
2010-07-24 17:59:49 UTC
Created attachment 49457 [details]
Crash testcase
Open this file, scroll down, then open a few other files of different types (e.g. xml, html, cpp). Scroll, search for some things. It will eventually crash
Kate crashed while keeping disk busy after I started a search with CTL-F. Crashed before finishing whatever it was doing with this large (600 MB) file (email inbox). Checking the Monitor, I see that RAM (1.5 G) and Swap (2 G) seem full. Trace is: Application: Kate (kate), signal SIGABRT [Current thread is 1 (Thread 0xb53039e0 (LWP 14540))] Thread 1 (Thread 0xb53039e0 (LWP 14540)): [KCrash Handler] #6 0xffffe430 in __kernel_vsyscall () #7 0xb5756990 in raise () from /lib/libc.so.6 #8 0xb57582c8 in abort () from /lib/libc.so.6 #9 0xb597daf8 in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib/libstdc++.so.6 #10 0xb597b445 in ?? () from /usr/lib/libstdc++.so.6 #11 0xb597b482 in std::terminate() () from /usr/lib/libstdc++.so.6 #12 0xb597b53b in __cxa_rethrow () from /usr/lib/libstdc++.so.6 #13 0xb5bcb2ec in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4 #14 0xb5bcd895 in QCoreApplication::exec() () from /usr/lib/libQtCore.so.4 #15 0xb5dd3777 in QApplication::exec() () from /usr/lib/libQtGui.so.4 #16 0xb77929dd in kdemain () from /usr/lib/libkdeinit4_kate.so #17 0x08048862 in _start () Is it not possible to search very large files? Thanks. *** Bug 280991 has been marked as a duplicate of this bug. *** Created attachment 70115 [details]
Patch fixing the issue
The bug is still present in current stable and trunk.
The problem is in dropDynamicContexts and the fact that base_startctx is initialized only in "init()" (see below valgrind messages).
The proposed patch fixes dropDynamicContexts by adding guards against unused highlights and "normal text" highlight.
valgrind --memcheck output (before fix)
Conditional jump or move depends on uninitialised value(s)
at 0x17C2CF0B: KateHighlighting::dropDynamicContexts() (qvector.h:343)
by 0x17C25A0E: KateHlManager::resetDynamicCtxs() (katesyntaxmanager.cpp:412)
by 0x17BE0510: KateBuffer::doHighlight(int, int, bool) (katebuffer.cpp:435)
by 0x17BB9779: KateDocument::kateTextLine(unsigned int) (katedocument.cpp:4786)
by 0x17C138C7: KateLineLayout::textLine(bool) const (katelinelayout.cpp:67)
by 0x17C0B5FC: KateRenderer::layoutLine(KSharedPtr<KateLineLayout>, int, bool) const (katerenderer.cpp:843)
by 0x17C10165: KateLayoutCache::line(int, int) (katelayoutcache.cpp:318)
by 0x17C10DC9: KateLayoutCache::updateViewCache(KTextEditor::Cursor const&, int, int) (katelayoutcache.cpp:233)
by 0x17C67DC4: KateViewInternal::doUpdateView(bool, int) (kateviewinternal.cpp:550)
by 0x17C6804B: KateViewInternal::updateView(bool, int) (kateviewinternal.cpp:524)
by 0x17C692BE: KateViewInternal::scrollPos(KTextEditor::Cursor&, bool, bool) (kateviewinternal.cpp:490)
by 0x17C69B29: KateViewInternal::scrollLines(int) (kateviewinternal.cpp:347)
Uninitialised value was created by a heap allocation
at 0x4A06C8E: operator new(unsigned long) (vg_replace_malloc.c:261)
by 0x17C264F1: KateHlManager::KateHlManager() (katesyntaxmanager.cpp:89)
by 0x17D02EE1: KateGlobal::KateGlobal() (kateglobal.cpp:136)
by 0x17D032D9: KateGlobal::self() (kateglobal.cpp:442)
by 0x9396258: KTextEditor::editor(char const*) (ktexteditor.cpp:186)
by 0x939E5E1: KTextEditor::EditorChooser::editor(QString const&, bool) (editorchooser.cpp:135)
by 0x4E4B609: KateDocManager::KateDocManager(QObject*) (katedocmanager.cpp:64)
by 0x4E457B1: KateApp::KateApp(KCmdLineArgs*) (kateapp.cpp:60)
by 0x4C11A5F: kdemain (katemain.cpp:373)
by 0x320861ECDC: (below main) (in /lib64/libc-2.12.so)
Conditional jump or move depends on uninitialised value(s)
at 0x17C2CECA: KateHighlighting::dropDynamicContexts() (katehighlight.cpp:247)
by 0x17C25A0E: KateHlManager::resetDynamicCtxs() (katesyntaxmanager.cpp:412)
by 0x17BE0510: KateBuffer::doHighlight(int, int, bool) (katebuffer.cpp:435)
by 0x17BB9779: KateDocument::kateTextLine(unsigned int) (katedocument.cpp:4786)
by 0x17C138C7: KateLineLayout::textLine(bool) const (katelinelayout.cpp:67)
by 0x17C0B5FC: KateRenderer::layoutLine(KSharedPtr<KateLineLayout>, int, bool) const (katerenderer.cpp:843)
by 0x17C10165: KateLayoutCache::line(int, int) (katelayoutcache.cpp:318)
by 0x17C10DC9: KateLayoutCache::updateViewCache(KTextEditor::Cursor const&, int, int) (katelayoutcache.cpp:233)
by 0x17C67D94: KateViewInternal::doUpdateView(bool, int) (kateviewinternal.cpp:550)
by 0x17C6801B: KateViewInternal::updateView(bool, int) (kateviewinternal.cpp:524)
by 0x17C6928E: KateViewInternal::scrollPos(KTextEditor::Cursor&, bool, bool) (kateviewinternal.cpp:490)
by 0x17C69AF9: KateViewInternal::scrollLines(int) (kateviewinternal.cpp:347)
Uninitialised value was created by a heap allocation
at 0x4A06C8E: operator new(unsigned long) (vg_replace_malloc.c:261)
by 0x17C262E2: KateHlManager::KateHlManager() (katesyntaxmanager.cpp:71)
by 0x17D02EB1: KateGlobal::KateGlobal() (kateglobal.cpp:136)
by 0x17D032A9: KateGlobal::self() (kateglobal.cpp:442)
by 0x9396258: KTextEditor::editor(char const*) (ktexteditor.cpp:186)
by 0x939E5E1: KTextEditor::EditorChooser::editor(QString const&, bool) (editorchooser.cpp:135)
by 0x4E4B609: KateDocManager::KateDocManager(QObject*) (katedocmanager.cpp:64)
by 0x4E457B1: KateApp::KateApp(KCmdLineArgs*) (kateapp.cpp:60)
by 0x4C11A5F: kdemain (katemain.cpp:373)
by 0x320861ECDC: (below main) (in /lib64/libc-2.12.so)
*** Bug 297710 has been marked as a duplicate of this bug. *** The review request fixes the issue: https://git.reviewboard.kde.org/r/104482/ Should be committed in time for KDE 4.8.3. Git commit 5e5cf873b55e84a76d6425f96db0a8d4ee513507 by Christoph Cullmann. Committed on 01/05/2012 at 11:34. Pushed by cullmann into branch 'master'. Patch by Valery Yundin Description: Memory corruption in dropDynamicContexts due to undefined value of base_startctx. The patch adds to dropDynamicContexts guards against unused highlights and "normal text" highlight. Testing Done: valgrind --tool=memcheck reports access to uninitialized memory when using test case from bug 245663 M +7 -5 part/syntax/katehighlight.cpp http://commits.kde.org/kate/5e5cf873b55e84a76d6425f96db0a8d4ee513507 |