https://bugs.kde.org/show_bug.cgi?id=439592

--- Comment #12 from Eugene Shalygin <eugene.shalygin+bugzilla....@gmail.com> 
---
Got back to this after some time. Seems like KDevelop's CMake parser can't
handle strings with 0 bytes inside. Specifically, creating the CMake console
project from the template and appending contents of
Tests/RunCMake/Syntax/NullTerminatedArgument.cmake file from the CMake project
to the CMakeLists.txt make KDevelop crash on it either during project loading
or upon opening the file.

Valgrind says:
==800842== Invalid read of size 1
==800842==    at 0x624870A: QUtf8::convertToUnicode(char const*, int,
QTextCodec::ConverterState*) (in /usr/lib64/libQt5Core.so.5.15.3)
==800842==    by 0x6248D55: QUtf8Codec::convertToUnicode(char const*, int,
QTextCodec::ConverterState*) const (in /usr/lib64/libQt5Core.so.5.15.3)
==800842==    by 0x60D1963: QString::fromLocal8Bit_helper(char const*, int) (in
/usr/lib64/libQt5Core.so.5.15.3)
==800842==    by 0x3A15398F: fromLocal8Bit (qstring.h:710)
==800842==    by 0x3A15398F:
CMakeListsParser::readCMakeFunction(cmListFileLexer_s*, CMakeFunctionDesc&)
(cmakelistsparser.cpp:180)
==800842==    by 0x3A1540CE: CMakeListsParser::readCMakeFile(QString const&)
(cmakelistsparser.cpp:126)
==800842==    by 0x3A1DEE17:
CMakeParseJob::run(QSharedPointer<ThreadWeaver::JobInterface>,
ThreadWeaver::Thread*) (cmakeparsejob.cpp:84)
==800842==    by 0x9C9E557:
ThreadWeaver::IdDecorator::run(QSharedPointer<ThreadWeaver::JobInterface>,
ThreadWeaver::Thread*) (in /usr/lib64/libKF5ThreadWeaver.so.5.92.0)
==800842==    by 0x9C9E366:
ThreadWeaver::Executor::run(QSharedPointer<ThreadWeaver::JobInterface> const&,
ThreadWeaver::Thread*) (in /usr/lib64/libKF5ThreadWeaver.so.5.92.0)
==800842==    by 0x9C9F232:
ThreadWeaver::Job::execute(QSharedPointer<ThreadWeaver::JobInterface> const&,
ThreadWeaver::Thread*) (in /usr/lib64/libKF5ThreadWeaver.so.5.92.0)
==800842==    by 0x9CA5A36: ThreadWeaver::Thread::run() (in
/usr/lib64/libKF5ThreadWeaver.so.5.92.0)
==800842==    by 0x605891B: QThreadPrivate::start(void*) (in
/usr/lib64/libQt5Core.so.5.15.3)
==800842==    by 0x67F9019: start_thread (in /lib64/libc.so.6)
==800842==  Address 0x508a1ff2 is 13 bytes after a block of size 5 alloc'd
==800842==    at 0x48447E5: malloc (vg_replace_malloc.c:381)
==800842==    by 0x680B2CA: strdup (in /lib64/libc.so.6)
==800842==    by 0x3A15145B: cmListFileLexerSetToken (cmListFileLexer.in.l:290)
==800842==    by 0x3A15260A: cmListFileLexer_yylex (cmListFileLexer.in.l:185)
==800842==    by 0x3A152C7E: cmListFileLexer_Scan (cmListFileLexer.in.l:507)
==800842==    by 0x3A1536EA:
CMakeListsParser::readCMakeFunction(cmListFileLexer_s*, CMakeFunctionDesc&)
(cmakelistsparser.cpp:158)
==800842==    by 0x3A1540CE: CMakeListsParser::readCMakeFile(QString const&)
(cmakelistsparser.cpp:126)
==800842==    by 0x3A1DEE17:
CMakeParseJob::run(QSharedPointer<ThreadWeaver::JobInterface>,
ThreadWeaver::Thread*) (cmakeparsejob.cpp:84)
==800842==    by 0x9C9E557:
ThreadWeaver::IdDecorator::run(QSharedPointer<ThreadWeaver::JobInterface>,
ThreadWeaver::Thread*) (in /usr/lib64/libKF5ThreadWeaver.so.5.92.0)
==800842==    by 0x9C9E366:
ThreadWeaver::Executor::run(QSharedPointer<ThreadWeaver::JobInterface> const&,
ThreadWeaver::Thread*) (in /usr/lib64/libKF5ThreadWeaver.so.5.92.0)
==800842==    by 0x9C9F232:
ThreadWeaver::Job::execute(QSharedPointer<ThreadWeaver::JobInterface> const&,
ThreadWeaver::Thread*) (in /usr/lib64/libKF5ThreadWeaver.so.5.92.0)
==800842==    by 0x9CA5A36: ThreadWeaver::Thread::run() (in
/usr/lib64/libKF5ThreadWeaver.so.5.92.0)


Debug build crashes under GDB after clearing duchain cache with the following
stacktrace:

#0  0x00007ffff5f36d1c in __pthread_kill_implementation () at /lib64/libc.so.6
#1  0x00007ffff5eeb6a2 in raise () at /lib64/libc.so.6
#2  0x00007ffff5ed6469 in abort () at /lib64/libc.so.6
#3  0x00007ffff5f2b278 in __libc_message () at /lib64/libc.so.6
#4  0x00007ffff5f407fa in  () at /lib64/libc.so.6
#5  0x00007ffff5f423e5 in _int_free () at /lib64/libc.so.6
#6  0x00007ffff5f44edf in free () at /lib64/libc.so.6
#7  0x00007ffff645c2a7 in QHashData::free_helper(void (*)(QHashData::Node*)) ()
at /usr/lib64/libQt5Core.so.5
#8  0x00007fffc0a50e0b in QHash<KDevelop::DUChainBase*,
QHashDummyValue>::freeData(QHashData*) (this=this@entry=0x7fff7a7fb110,
x=<optimized out>) at /usr/include/qt5/QtCore/qhash.h:619
#9  0x00007fffc0a50aea in QHash<KDevelop::DUChainBase*,
QHashDummyValue>::~QHash() (this=0x7fff7a7fb110, __in_chrg=<optimized out>) at
/usr/include/qt5/QtCore/qhash.h:250
#10 QSet<KDevelop::DUChainBase*>::~QSet() (this=0x7fff7a7fb110,
__in_chrg=<optimized out>) at /usr/include/qt5/QtCore/qset.h:53
#11 KDevelop::AbstractContextBuilder<QVectorIterator<CMakeFunctionDesc>,
CMakeFunctionDesc>::~AbstractContextBuilder() (this=0x7fff7a7fb040,
__in_chrg=<optimized out>)
    at
/usr/src/debug/dev-util/kdevelop-9999/kdevelop-9999/kdevplatform/language/duchain/builders/abstractcontextbuilder.h:51
#12 ContextBuilder::~ContextBuilder() (this=0x7fff7a7fb040,
__in_chrg=<optimized out>) at
/usr/src/debug/dev-util/kdevelop-9999/kdevelop-9999/plugins/cmake/duchain/contextbuilder.h:15
#13 KDevelop::AbstractDeclarationBuilder<QVectorIterator<CMakeFunctionDesc>,
CMakeFunctionDesc, ContextBuilder>::~AbstractDeclarationBuilder()
(this=0x7fff7a7fb040, __in_chrg=<optimized out>)
    at
/usr/src/debug/dev-util/kdevelop-9999/kdevelop-9999/kdevplatform/language/duchain/builders/abstractdeclarationbuilder.h:24
#14 DeclarationBuilder::~DeclarationBuilder() (this=0x7fff7a7fb040,
__in_chrg=<optimized out>) at
/usr/src/debug/dev-util/kdevelop-9999/kdevelop-9999/plugins/cmake/duchain/declarationbuilder.h:17
#15 CMakeParseJob::run(QSharedPointer<ThreadWeaver::JobInterface>,
ThreadWeaver::Thread*) (this=0x55555c9797f0) at
/usr/src/debug/dev-util/kdevelop-9999/kdevelop-9999/plugins/cmake/duchain/cmakeparsejob.cpp:108
#16 0x00007ffff2b7d558 in
ThreadWeaver::IdDecorator::run(QSharedPointer<ThreadWeaver::JobInterface>,
ThreadWeaver::Thread*) () at /usr/lib64/libKF5ThreadWeaver.so.5
#17 0x00007ffff2b7d367 in
ThreadWeaver::Executor::run(QSharedPointer<ThreadWeaver::JobInterface> const&,
ThreadWeaver::Thread*) () at /usr/lib64/libKF5ThreadWeaver.so.5
#18 0x00007ffff2b7e233 in
ThreadWeaver::Job::execute(QSharedPointer<ThreadWeaver::JobInterface> const&,
ThreadWeaver::Thread*) () at /usr/lib64/libKF5ThreadWeaver.so.5
#19 0x00007ffff2b84a37 in ThreadWeaver::Thread::run() () at
/usr/lib64/libKF5ThreadWeaver.so.5
#20 0x00007ffff642491c in QThreadPrivate::start(void*) () at
/usr/lib64/libQt5Core.so.5
#21 0x00007ffff5f3501a in start_thread () at /lib64/libc.so.6
#22 0x00007ffff5fb7f1c in clone3 () at /lib64/libc.so

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to