diff options
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); |