D15826: [Balooshow] Avoid out-of-bounds access when accessing corrupt db data

Igor Poboiko noreply at phabricator.kde.org
Mon Oct 8 22:40:58 BST 2018


poboiko added inline comments.

INLINE COMMENTS

> bruns wrote in main.cpp:211
> but you are not allowed to access `word[2]` if `word.length() < 3`.

We don't access it directly, and `indexOf` performs internal checks. For example, `QStringLiteral("ab").indexOf('c', 5)` seem to be perfectly valid code, which returns `-1`. 
On one hand, it makes sense, and I think we can rely on it. On the other - it's not actually stated directly in the documentation <http://doc.qt.io/qt-5/qstring.html#indexOf>...

> bruns wrote in main.cpp:218
> None of the other messages is an error message, but just regular output. Hm, maybe `i18n("Internal Error: %1", message)`.

OK, I think that's better

REPOSITORY
  R293 Baloo

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

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


More information about the Kde-frameworks-devel mailing list