lmdb: Avoid getting packages with empty name, can lead to exception

This commit is contained in:
Martchus 2022-02-20 19:28:44 +01:00
parent 334bb1faa9
commit d11ba43bf0
1 changed files with 4 additions and 0 deletions

View File

@ -85,6 +85,10 @@ auto StorageCache<StorageEntriesType, StorageType, SpecType>::retrieve(Storage &
template <typename StorageEntriesType, typename StorageType, typename SpecType>
auto StorageCache<StorageEntriesType, StorageType, SpecType>::retrieve(Storage &storage, RWTxn *txn, const std::string &entryName) -> SpecType
{
// do not attempt to fetch empty entries (apprently can lead to "Getting data: MDB_BAD_VALSIZE: Unsupported size of key/DB name/data, or wrong DUPFIXED size")
if (entryName.empty()) {
return SpecType(0, std::shared_ptr<Entry>());
}
// check for package in cache
using CacheRef = typename Entries::Ref;
const auto ref = CacheRef(storage, entryName);