Bug 377036 - Kdevelop crashed when documentating template function [KDevelop::VariableDescription::VariableDescription]
Summary: Kdevelop crashed when documentating template function [KDevelop::VariableDesc...
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: Doxygen integration (show other bugs)
Version: 5.0.80
Platform: Ubuntu Linux
: NOR crash
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-02-28 21:26 UTC by Robin Christ
Modified: 2017-03-05 14:10 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 5.1.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Robin Christ 2017-02-28 21:26:10 UTC
Consider the following code:

template<template<typename> typename T1, template<typename> typename T2, template<typename> typename T3>
void foo(T1<float> &vertexes, T2<float> &sources, T3<float> &frequencies, rdt::DirectSoundCalculationOptions const& calcOptions );

Place your pointer in this void and press Code -> Document Declaration (or alternatively Alt+Shift+D) and see your Kdevelop Crash.
Comment 1 Robin Christ 2017-03-04 16:26:46 UTC
New minimal example:
template<template<typename> typename T1>
void foo(T1<float> bla);
Comment 2 Kevin Funk 2017-03-04 20:14:11 UTC
Confirmed.

Backtrace:

ASAN:DEADLYSIGNAL
=================================================================
==2270==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7fa0176b3e22 bp 0x7ffc9dfde9b0 sp 0x7ffc9dfde780 T0)
==2270==The signal is caused by a READ memory access.
==2270==Hint: address points to the zero page.
    #0 0x7fa0176b3e21 in KDevelop::VariableDescription::VariableDescription(KDevelop::DUChainPointer<KDevelop::Declaration> const&) /home/kfunk/devel/src/kf5/kdevplatform-stable/language/codegen/codedescription.cpp:79:45
    #1 0x7fa0176b4fe4 in KDevelop::FunctionDescription::FunctionDescription(KDevelop::DUChainPointer<KDevelop::Declaration> const&) /home/kfunk/devel/src/kf5/kdevplatform-stable/language/codegen/codedescription.cpp:136:39
    #2 0x7f9ff1daf511 in CodeUtilsPlugin::documentDeclaration() /home/kfunk/devel/src/kf5/kdevplatform-stable/plugins/codeutils/codeutilsplugin.cpp:119:43
    #3 0x7f9ff1db6db0 in CodeUtilsPlugin::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) /home/kfunk/devel/build/kf5/kdevplatform-stable/plugins/codeutils/kdevcodeutils_automoc.dir/moc_codeutilsplugi_5ZHSIAJAHPEKRP.cpp:70:21
    #4 0x7fa01a978b48 in QMetaObject::activate(QObject*, int, int, void**) (/usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0x2b2b48)
    #5 0x7fa01b27d301 in QAction::triggered(bool) (/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x153301)
    #6 0x7fa01b27feff in QAction::activate(QAction::ActionEvent) (/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x155eff)
    #7 0x7fa01b40a8e9  (/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x2e08e9)
    #8 0x7fa01b410acb  (/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x2e6acb)
    #9 0x7fa01b414c45 in QMenu::mouseReleaseEvent(QMouseEvent*) (/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x2eac45)
    #10 0x7fa01b2cc497 in QWidget::event(QEvent*) (/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x1a2497)
    #11 0x7fa01b4156fa in QMenu::event(QEvent*) (/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x2eb6fa)
    #12 0x7fa01b2868ab in QApplicationPrivate::notify_helper(QObject*, QEvent*) (/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x15c8ab)
    #13 0x7fa01b28cc06 in QApplication::notify(QObject*, QEvent*) (/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x162c06)
    #14 0x7fa01a94b3af in QCoreApplication::notifyInternal2(QObject*, QEvent*) (/usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0x2853af)
    #15 0x7fa01b28b2d4 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) (/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x1612d4)
    #16 0x7fa01b2e710f  (/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x1bd10f)
    #17 0x7fa01b2e96d2  (/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x1bf6d2)
    #18 0x7fa01b2868ab in QApplicationPrivate::notify_helper(QObject*, QEvent*) (/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x15c8ab)
    #19 0x7fa01b28bd4e in QApplication::notify(QObject*, QEvent*) (/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x161d4e)
    #20 0x7fa01a94b3af in QCoreApplication::notifyInternal2(QObject*, QEvent*) (/usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0x2853af)
    #21 0x7fa01ac9e5f2 in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) (/usr/lib/x86_64-linux-gnu/libQt5Gui.so.5+0x1005f2)
    #22 0x7fa01ac9fe04 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) (/usr/lib/x86_64-linux-gnu/libQt5Gui.so.5+0x101e04)
    #23 0x7fa01ac7db2a in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) (/usr/lib/x86_64-linux-gnu/libQt5Gui.so.5+0xdfb2a)
    #24 0x7f9ffe10d65f  (/usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5+0x7165f)
    #25 0x7fa010b8f7d6 in g_main_context_dispatch (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x4a7d6)
    #26 0x7fa010b8fa3f  (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x4aa3f)
    #27 0x7fa010b8faeb in g_main_context_iteration (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x4aaeb)
    #28 0x7fa01a9a148e in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (/usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0x2db48e)
    #29 0x7fa01a9490f9 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (/usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0x2830f9)
    #30 0x7fa01a95190b in QCoreApplication::exec() (/usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0x28b90b)
    #31 0x51b63b in main /home/kfunk/devel/src/kf5/kdevelop-stable/app/main.cpp:763:12
    #32 0x7fa01944d3f0 in __libc_start_main /build/glibc-jxM2Ev/glibc-2.24/csu/../csu/libc-start.c:291
    #33 0x4232d9 in _start (/home/kfunk/devel/install/kf5-stable/bin/kdevelop+0x4232d9)
Comment 3 Kevin Funk 2017-03-05 14:10:54 UTC
Git commit 63ba13534516a3552b2096c901a66a2952d71da1 by Kevin Funk.
Committed on 05/03/2017 at 14:10.
Pushed by kfunk into branch '5.1'.

codegen: Fix crash when documenting template func

With the code snippet from the bug report KDevelop now still adds
non-sense as documentation, but at least won't crash anymore.

This needs better unit tests...
FIXED-IN: 5.1.0

M  +3    -1    language/codegen/codedescription.cpp

https://commits.kde.org/kdevplatform/63ba13534516a3552b2096c901a66a2952d71da1