[Qt-interest] segmentation fault with QtSql mysql driver

Bill KING bill.king at trolltech.com
Thu Jan 22 01:13:26 CET 2009


There's been some cleanup for 4.5, can you test the pre-release code and
see if it fixes it? (It should).

The real problem is that mysql doesn't check null pointers before
dereferencing them. At all. Even when it's the one that freed them in
the first place.

So, yes, I'd love for someone to report this to mysql :) More voices the
merrier. But, that said, the Qt could should be more robust now too.

pepone.onrez wrote:
> Hi there
>
> I using Qt-4.4.2 mysql drivers in a program to make a simple query,
> the program runs fine but if i stop the mysql server while a query is
> running the program crash, as show it the next stack trace the crash
> occurs when QSqlQuery goes out of scope. Should i report a bug to Qt
> Mysql or both for this issue?
>
> My enviroment is:
> Qt-4.4.2
> mysql-5.1.30,
> gcc-4.1.2
> linux centos 5.2
>
>
> #0  0x00c535f8 in mysql_next_result () from
> /usr/local/lib/mysql/libmysqlclient_r.so.16
> #1  0x0041aaa0 in QMYSQLResult::cleanup (this=0x8199bd0) at
> drivers/mysql/qsql_mysql.cpp:412
> #2  0x0041b074 in ~QMYSQLResult (this=0x8199bd0) at
> drivers/mysql/qsql_mysql.cpp:391
> #3  0x003ffa0b in ~QSqlQueryPrivate (this=0x818f810) at kernel/qsqlquery.cpp:97
> #4  0x003ffa7d in ~QSqlQuery (this=0xb57c67c8) at kernel/qsqlquery.cpp:248
> #5  0x0809d11d in PermissionsVerifierI::checkPermissions
> (this=0x81774a0, user=@0xb57c6be8, passwd=@0xb57c6be4,
> reason=@0xb57c6b28, current=@0xb57c6900) at
> PermissionsVerifierI.cpp:178
> #6  0x00146be5 in Glacier2::PermissionsVerifier::__write () from
> /usr/lib/libGlacier2.so.33
> #7  0x005ac228 in Ice::Object::__collocDispatch () from /usr/lib/libIce.so.33
> #8  0x00148a21 in
> IceDelegateD::Glacier2::PermissionsVerifier::checkPermissions () from
> /usr/lib/libGlacier2.so.33
> #9  0x001477cb in
> IceProxy::Glacier2::PermissionsVerifier::checkPermissions () from
> /usr/lib/libGlacier2.so.33
> #10 0x08099c68 in
> IceProxy::Glacier2::PermissionsVerifier::checkPermissions
> (this=0x8189818, userId=@0xb57c6be8, password=@0xb57c6be4,
> reason=@0xb57c6b28) at /usr/include/Glacier2/PermissionsVerifier.h:155
> #11 0x080970c1 in PollingChatSessionFactoryI::create (this=0x8177478,
> name=@0xb57c6be8, password=@0xb57c6be4, c=@0xb57c6d54) at
> PollingChatSessionFactoryI.cpp:80
> #12 0x080722d6 in PollingChat::PollingChatSessionFactory::___create
> (this=0x8177478, __inS=@0xb57c6d54, __current=@0xb57c6d54) at
> PollingChat.cpp:2363
> #13 0x08072544 in PollingChat::PollingChatSessionFactory::__dispatch
> (this=0x8177478, in=@0xb57c6d54, current=@0xb57c6d54) at
> PollingChat.cpp:2396
> #14 0x0053fdab in IceInternal::Incoming::invoke () from /usr/lib/libIce.so.33
> #15 0x00509f7c in Ice::ConnectionI::invokeAll () from /usr/lib/libIce.so.33
> #16 0x00510f2e in Ice::ConnectionI::message () from /usr/lib/libIce.so.33
> #17 0x0063a544 in IceInternal::ThreadPool::run () from /usr/lib/libIce.so.33
> #18 0x0063af5f in IceInternal::ThreadPool::EventHandlerThread::run ()
> from /usr/lib/libIce.so.33
> #19 0x001c10ae in IceUtil::Thread::~Thread$base () from
> /usr/lib/libIceUtil.so.33
> #20 0x001d645b in start_thread () from /lib/libpthread.so.0
> #21 0x002b8e5e in clone () from /lib/libc.so.6
> (gdb)
>
> (gdb) frame 5
> #5  0x0809d11d in PermissionsVerifierI::checkPermissions
> (this=0x81774a0, user=@0xb57c6be8, passwd=@0xb57c6be4,
> reason=@0xb57c6b28, current=@0xb57c6900) at
> PermissionsVerifierI.cpp:178
> 178         return false;
> (gdb) info locals
> sync = {_mutex = @0x81774ac, _acquired = true}
> db = {static defaultConnection = 0x42e015 "qt_sql_default_connection",
> d = 0x817fea8}
> query = {d = 0x818f810}
> hash = {static npos = 4294967295, _M_dataplus =
> {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No
> data fields>}, <No data fields>}, _M_p = 0x819bedc
> "8aa7c24ec4e256ce9b4bc11f7880f695"}}
> queryString = <incomplete type>
>
>
> Regards,
>
> José Manuel, Gutíerrez de la Concha
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>   


-- 
Bill King, Software Engineer
Qt Software, Nokia Pty Ltd
Brisbane Office




More information about the Qt-interest-old mailing list