<table><tr><td style="">poboiko created this revision.<br />poboiko added reviewers: Baloo, bruns, ngraham.<br />Herald added projects: Frameworks, Baloo.<br />poboiko requested review of this revision.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D22502">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>It is possible to create an invalid entry inside includedFolders, for example:<br />
by creating some folder, adding it to config and then deleting it.</p>
<p>If such entry appears inside config, for example, <tt style="background: #ebebeb; font-size: 13px;">IndexCleaner</tt> will go mad:<br />
it calculates the id of each entry from the config (which for non-existent<br />
file resolves to 0), and then calls <tt style="background: #ebebeb; font-size: 13px;">tr.removeRecursively(0, shouldDelete)</tt>.<br />
Which either crashes due to assert (if it's a debug build) or silently runs<br />
<tt style="background: #ebebeb; font-size: 13px;">removeRecursively</tt> for the whole tree.</p>
<p>This patch omits invalid entries when building folders cache inside config,<br />
and adds unit test for such case</p></div></div><br /><div><strong>TEST PLAN</strong><div><p>ctest</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R293 Baloo</div></div></div><br /><div><strong>BRANCH</strong><div><div>removed-include-folder (branched from master)</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D22502">https://phabricator.kde.org/D22502</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>autotests/unit/file/fileindexerconfigtest.cpp<br />
autotests/unit/file/fileindexerconfigtest.h<br />
src/file/fileindexerconfig.cpp</div></div></div><br /><div><strong>To: </strong>poboiko, Baloo, bruns, ngraham<br /><strong>Cc: </strong>kde-frameworks-devel, LeGast00n, sbergeron, fbampaloukas, domson, ashaposhnikov, michaelh, astippich, spoorun, ngraham, bruns, abrahams<br /></div>