diff options
| author | Dan Engelbrecht <[email protected]> | 2025-12-04 15:42:02 +0100 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2025-12-04 15:42:02 +0100 |
| commit | 4e5faaf1b76ec7ae7e2ddefc8591ef3a9d79cc16 (patch) | |
| tree | de675194f99888c008c2b8b89a180049bbc9c761 /src/zenstore | |
| parent | 5.7.13 (diff) | |
| download | zen-4e5faaf1b76ec7ae7e2ddefc8591ef3a9d79cc16.tar.xz zen-4e5faaf1b76ec7ae7e2ddefc8591ef3a9d79cc16.zip | |
add checks to protect against access violation due to failed disk read (#675)
* add checkes to protect against access violation due to failed disk read
Diffstat (limited to 'src/zenstore')
| -rw-r--r-- | src/zenstore/cache/cachedisklayer.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/zenstore/cache/cachedisklayer.cpp b/src/zenstore/cache/cachedisklayer.cpp index 4f0d412ec..46dfbd912 100644 --- a/src/zenstore/cache/cachedisklayer.cpp +++ b/src/zenstore/cache/cachedisklayer.cpp @@ -648,6 +648,13 @@ BucketManifestSerializer::ReadSidecarFile(RwLock::ExclusiveLockScope& B while (RemainingEntryCount--) { const ManifestData* Entry = Sidecar.MakeView<ManifestData>(CurrentReadOffset); + if (Entry == nullptr) + { + ZEN_WARN("Failed to read sidecar file '{}'. Failed to read {} bytes at {}", + SidecarPath, + sizeof(ManifestData), + CurrentReadOffset); + } CurrentReadOffset += sizeof(ManifestData); if (auto It = Index.find(Entry->Key); It != Index.end()) @@ -1078,6 +1085,11 @@ ZenCacheDiskLayer::CacheBucket::ReadIndexFile(RwLock::ExclusiveLockScope&, const while (RemainingEntryCount--) { const DiskIndexEntry* Entry = FileBuffer.MakeView<DiskIndexEntry>(CurrentReadOffset); + if (Entry == nullptr) + { + ZEN_WARN("skipping invalid entry in '{}', failed to read {} bytes at {}", IndexPath, sizeof(DiskIndexEntry), CurrentReadOffset); + continue; + } CurrentReadOffset += sizeof(DiskIndexEntry); if (!cache::impl::ValidateCacheBucketIndexEntry(*Entry, InvalidEntryReason)) |