From 9228b3ba170a0f68dbb432b2455c75d5fff21506 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Wed, 3 May 2017 21:29:28 +0200 Subject: Sanity check db names lmdb and sink deal badly with e.g. a string containing a null in the millde as db name. Thus we try to protect better against it. This is an actual problem we triggered: https://phabricator.kde.org/T5880 --- common/storage/entitystore.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'common/storage') diff --git a/common/storage/entitystore.cpp b/common/storage/entitystore.cpp index b7309ab..4cb4641 100644 --- a/common/storage/entitystore.cpp +++ b/common/storage/entitystore.cpp @@ -320,6 +320,11 @@ void EntityStore::cleanupEntityRevisionsUntil(qint64 revision) { const auto uid = DataStore::getUidFromRevision(d->transaction, revision); const auto bufferType = DataStore::getTypeFromRevision(d->transaction, revision); + if (bufferType.isEmpty() || uid.isEmpty()) { + SinkErrorCtx(d->logCtx) << "Failed to find revision during cleanup: " << revision; + Q_ASSERT(false); + return; + } SinkTraceCtx(d->logCtx) << "Cleaning up revision " << revision << uid << bufferType; DataStore::mainDatabase(d->transaction, bufferType) .scan(uid, -- cgit v1.2.3