From 4e5faaf1b76ec7ae7e2ddefc8591ef3a9d79cc16 Mon Sep 17 00:00:00 2001 From: Dan Engelbrecht Date: Thu, 4 Dec 2025 15:42:02 +0100 Subject: 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 --- src/zenremotestore/chunking/chunkingcontroller.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/zenremotestore/chunking/chunkingcontroller.cpp') diff --git a/src/zenremotestore/chunking/chunkingcontroller.cpp b/src/zenremotestore/chunking/chunkingcontroller.cpp index 91ca18d10..0bb02d07f 100644 --- a/src/zenremotestore/chunking/chunkingcontroller.cpp +++ b/src/zenremotestore/chunking/chunkingcontroller.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include ZEN_THIRD_PARTY_INCLUDES_START @@ -437,6 +438,10 @@ public: { const uint64_t BufferSize = std::min(RawSize - Offset, BufferingSize); MemoryView ChunkData = SourceBuffer.MakeView(BufferSize, Offset); + if (ChunkData.IsEmpty()) + { + throw std::runtime_error(fmt::format("Invalid format. Expected to read {} bytes at {}", BufferSize, Offset)); + } FullHasher.Append(ChunkData); ChunkHasher.Append(ChunkData); BytesProcessed.fetch_add(BufferSize); -- cgit v1.2.3