aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2023-05-02 19:44:28 +0200
committerGitHub <[email protected]>2023-05-02 19:44:28 +0200
commit66809d1c0b1ddf2fd1d4d465d7fdb3d6646663a4 (patch)
treeb611054abb8da4d717b3586e89611abc8d3e3208
parentv0.2.8 (diff)
downloadzen-66809d1c0b1ddf2fd1d4d465d7fdb3d6646663a4.tar.xz
zen-66809d1c0b1ddf2fd1d4d465d7fdb3d6646663a4.zip
Treat reading outside of block store file as a not found error. We may encounter truncated blocks due to earlier abnormal termination of zenserver or disk failures. (#268)
-rw-r--r--CHANGELOG.md3
-rw-r--r--src/zenstore/blockstore.cpp4
2 files changed, 7 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 79e106279..02f85cdba 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,7 @@
##
+- Bugfix: Treat reading outside of block store file as a not found error. We may encounter truncated blocks due to earlier abnormal termination of zenserver or disk failures.
+
+## 0.2.8
- Feature: ASSERTs triggered at runtime are sent directly to Sentry with callstack if sentry is enabled
- Bugfix: Verify that there are blocks to GC for block store garbage collect (void division by zero)
- Bugfix: Write log error and flush log before reporting error to Sentry/error logger
diff --git a/src/zenstore/blockstore.cpp b/src/zenstore/blockstore.cpp
index 5dfa10c91..e19712c40 100644
--- a/src/zenstore/blockstore.cpp
+++ b/src/zenstore/blockstore.cpp
@@ -79,6 +79,10 @@ BlockStoreFile::MarkAsDeleteOnClose()
IoBuffer
BlockStoreFile::GetChunk(uint64_t Offset, uint64_t Size)
{
+ if ((Offset + Size) > m_IoBuffer.GetSize())
+ {
+ return IoBuffer();
+ }
return IoBuffer(m_IoBuffer, Offset, Size);
}