From d11ba43bf08beffdf63c97feb7ef8577ccb4bb8c Mon Sep 17 00:00:00 2001 From: Martchus Date: Sun, 20 Feb 2022 19:28:44 +0100 Subject: [PATCH] lmdb: Avoid getting packages with empty name, can lead to exception --- libpkg/data/storage.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libpkg/data/storage.cpp b/libpkg/data/storage.cpp index 86ed0f1..57c9752 100644 --- a/libpkg/data/storage.cpp +++ b/libpkg/data/storage.cpp @@ -85,6 +85,10 @@ auto StorageCache::retrieve(Storage & template auto StorageCache::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()); + } // check for package in cache using CacheRef = typename Entries::Ref; const auto ref = CacheRef(storage, entryName);