diff options
Diffstat (limited to 'zenstore')
| -rw-r--r-- | zenstore/compactcas.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/zenstore/compactcas.cpp b/zenstore/compactcas.cpp index 174f59ac5..a28068d24 100644 --- a/zenstore/compactcas.cpp +++ b/zenstore/compactcas.cpp @@ -1153,13 +1153,14 @@ CasContainerStrategy::MigrateLegacyData(bool CleanSource) { Stopwatch Timer; const auto __ = MakeGuard([this, &LegacyDiskIndex, &Timer] { - ZEN_INFO("read store '{}' legacy index containing #{} entries in {}", + ZEN_INFO("read store '{}' legacy log containing #{} entries in {}", m_Config.RootDirectory / m_ContainerBaseName, LegacyDiskIndex.size(), NiceTimeSpanMs(Timer.GetElapsedTimeMs())); }); if (LegacyCasLog.Initialize()) { + uint64_t BlockFileSize = BlockFile.FileSize(); LegacyDiskIndex.reserve(LegacyCasLog.GetLogCount()); LegacyCasLog.Replay( [&](const LegacyCasDiskIndexEntry& Record) { @@ -1174,6 +1175,11 @@ CasContainerStrategy::MigrateLegacyData(bool CleanSource) ZEN_WARN("skipping invalid entry in '{}', reason: '{}'", LegacyLogPath, InvalidEntryReason); return; } + if (Record.Location.GetOffset() + Record.Location.GetSize() > BlockFileSize) + { + ZEN_WARN("skipping invalid entry in '{}', reason: location is outside of file", LegacyLogPath); + return; + } if (m_LocationMap.contains(Record.Key)) { return; |