D19371: Tags ioslave: Do not crash for the "tags:/" URL

Jonathan Marten noreply at phabricator.kde.org
Tue Feb 26 21:05:54 GMT 2019


marten created this revision.
marten added a reviewer: Baloo.
Herald added projects: Frameworks, Baloo.
Herald added a subscriber: kde-frameworks-devel.
marten requested review of this revision.

REVISION SUMMARY
  Bug https://bugs.kde.org/show_bug.cgi?id=400594 was fixed by https://commits.kde.org/baloo/f4dd3f7bab790734b47a31c70fbb68297d4d3062
  which checks for the URL starting with "tags://" and considering this to be an invalid URL.  This is fine, but the problem is that if the URL "tags:/" is
  passed in the string is not long enough and QString::at() asserts.  This is seen as a crash of the ioslave every time the right click menu is popped up
  in Konqueror (on any sort of view), or from the command line by doing "kioclient5 ls tags:/":
  
  kio_tags(11869) unknown: ASSERT: "uint(i) < uint(size())" in file /usr/include/qt5/QtCore/qstring.h, line 934
  
  #10 0x00007f3d402fe0bc in qt_assert(char const*, char const*, int) () from /usr/lib64/libQt5Core.so.5
  #11 0x00007f3d36eec337 in QString::at (i=6, this=0x7ffd4531d8a8) at /usr/include/qt5/QtCore/qstring.h:934
  #12 Baloo::TagsProtocol::parseUrl (this=this at entry=0x7ffd4531da60, url=..., flags=...) at baloo/baloo/src/kioslaves/tags/kio_tags.cpp:299
  #13 0x00007f3d36eedda6 in Baloo::TagsProtocol::listDir (this=0x7ffd4531da60, url=...) at baloo/baloo/src/kioslaves/tags/kio_tags.cpp:59
  #14 0x00007f3d3663e1de in KIO::SlaveBase::dispatch (this=0x7ffd4531da70, command=71, data=...) at kio/src/core/slavebase.cpp:1176
  #15 0x00007f3d3663f78e in KIO::SlaveBase::dispatchLoop (this=0x7ffd4531da70) at kio/src/core/slavebase.cpp:325
  #16 0x00007f3d36ef1943 in kdemain (argc=<optimized out>, argv=<optimized out>) at baloo/baloo/src/kioslaves/tags/kio_tags.cpp:486
  
  The QString::at() needs to be guarded by a length check.

TEST PLAN
  Built Baloo with this change, verified that no crash happens when using the URL "tags:/"

REPOSITORY
  R293 Baloo

REVISION DETAIL
  https://phabricator.kde.org/D19371

AFFECTED FILES
  src/kioslaves/tags/kio_tags.cpp

To: marten, #baloo
Cc: kde-frameworks-devel, domson, ashaposhnikov, michaelh, astippich, spoorun, ngraham, bruns, abrahams
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20190226/e0ea2af6/attachment.html>


More information about the Kde-frameworks-devel mailing list