aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2024-08-12 15:34:58 +0200
committerGitHub Enterprise <[email protected]>2024-08-12 15:34:58 +0200
commita95dd553c76184b36248ffbe7fdb5b033af53c64 (patch)
treed1eb77b292777ef5ba48831db5e84e21e944015b /src
parentmake oplog lsn unsigned (#107) (diff)
downloadzen-a95dd553c76184b36248ffbe7fdb5b033af53c64.tar.xz
zen-a95dd553c76184b36248ffbe7fdb5b033af53c64.zip
project store chunk requests that are out of range will be treated as not found (#108)
* project store chunk requests that are out of range will be treaded as not found * add chunkid to log
Diffstat (limited to 'src')
-rw-r--r--src/zenserver/projectstore/projectstore.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/zenserver/projectstore/projectstore.cpp b/src/zenserver/projectstore/projectstore.cpp
index 438943f75..a6f058cf4 100644
--- a/src/zenserver/projectstore/projectstore.cpp
+++ b/src/zenserver/projectstore/projectstore.cpp
@@ -3185,6 +3185,19 @@ ProjectStore::GetChunkRange(const std::string_view ProjectId,
Size = RawSize - Offset;
}
+ if (Size == 0)
+ {
+ return {
+ HttpResponseCode::NotFound,
+ fmt::format("Chunk request for range outside of chunk '{}/{}'. Request: Chunk: {}, Offset: {}, Size: {}, ChunkSize: {}",
+ ProjectId,
+ OplogId,
+ ChunkId,
+ Offset,
+ Size,
+ RawSize)};
+ }
+
if (AcceptType == ZenContentType::kBinary)
{
OutChunk = CompositeBuffer(Compressed.Decompress(Offset, Size));
@@ -3216,6 +3229,19 @@ ProjectStore::GetChunkRange(const std::string_view ProjectId,
{
Size = Chunk.GetSize() - Offset;
}
+
+ if (Size == 0)
+ {
+ return {HttpResponseCode::NotFound,
+ fmt::format("Chunk request for range outside of chunk '{}/{}'. Request: Chunk: {}, Offset: {}, Size: {}, ChunkSize: {}",
+ ProjectId,
+ OplogId,
+ ChunkId,
+ Offset,
+ Size,
+ Chunk.GetSize())};
+ }
+
OutChunk = CompositeBuffer(SharedBuffer(IoBuffer(std::move(Chunk), Offset, Size)));
}
else