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/zenremotestore/chunking/chunkingcontroller.cpp | |
| 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/zenremotestore/chunking/chunkingcontroller.cpp')
| -rw-r--r-- | src/zenremotestore/chunking/chunkingcontroller.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
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 <zencore/basicfile.h> #include <zencore/compactbinaryutil.h> #include <zencore/filesystem.h> +#include <zencore/fmtutils.h> #include <zencore/trace.h> ZEN_THIRD_PARTY_INCLUDES_START @@ -437,6 +438,10 @@ public: { const uint64_t BufferSize = std::min<uint64_t>(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); |