poboiko created this revision.
poboiko added reviewers: Baloo, bruns, ngraham.
Herald added projects: Frameworks, Baloo.
poboiko requested review of this revision.

REVISION SUMMARY
  It is possible to create an invalid entry inside includedFolders, for example:
  by creating some folder, adding it to config and then deleting it.
  
  If such entry appears inside config, for example, `IndexCleaner` will go mad:
  it calculates the id of each entry from the config (which for non-existent
  file resolves to 0), and then calls `tr.removeRecursively(0, shouldDelete)`.
  Which either crashes due to assert (if it's a debug build) or silently runs
  `removeRecursively` for the whole tree.
  
  This patch omits invalid entries when building folders cache inside config,
  and adds unit test for such case

TEST PLAN
  ctest

REPOSITORY
  R293 Baloo

BRANCH
  removed-include-folder (branched from master)

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

AFFECTED FILES
  autotests/unit/file/fileindexerconfigtest.cpp
  autotests/unit/file/fileindexerconfigtest.h
  src/file/fileindexerconfig.cpp

To: poboiko, #baloo, bruns, ngraham
Cc: kde-frameworks-devel, LeGast00n, sbergeron, fbampaloukas, domson, 
ashaposhnikov, michaelh, astippich, spoorun, ngraham, bruns, abrahams

Reply via email to