D15826: [Balooshow] Avoid out-of-bounds access when accessing corrupt db data
Igor Poboiko
noreply at phabricator.kde.org
Mon Oct 8 20:09:10 BST 2018
poboiko added a comment.
Maybe we should print also a suggestion to user, something like (maybe rephrase it better)
WARNING:
Looks like your index is corrupted.
We suggest you to run `balooctl disable && balooctl disable` to wipe it and rebuild from scratch
so they won't have to google what to do (there's still not much can be done in that case)
BTW, does it also wipe tags and other user-provided metadata?
INLINE COMMENTS
> bruns wrote in main.cpp:204
> See `word[0]` access directly after.
> I have fixed to many "shouldn't be" errors/crashes due to corrupt DB values in the past.
OK, you're right, I guess.
> bruns wrote in main.cpp:211
> This is the exact case I have had - "X<garbage">.
> The code after (`word.indexOf('-', 2)`) requires a check for length >= 3 here (code correctness), semantics require >= 4.
But still, if the term is short (namely, length < 4), we will either won't have "-" (this corresponds to `posOfNonNumeric < 0`, and that's `X<garbage>`), or it will be the last symbol (something like `X1-` - which is `posOfNonNumeric+1 == word.length()`).
> bruns wrote in main.cpp:218
> I am not really sure:
> balooctl -x is a quite low level debug tool. This is a diagnostic message only printed in case of DB errors. Translated strings make search on the web harder.
On the one hand, you're right. On the other hand, the output should be consistent. Other messages here are translated.
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/34c15d9e/attachment.html>
More information about the Kde-frameworks-devel
mailing list