aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2024-06-14 22:12:57 +0200
committerGitHub Enterprise <[email protected]>2024-06-14 22:12:57 +0200
commitee5fcbce34eaef87ffced2a993c8443af4af4fe2 (patch)
tree7eeb7df5c48d11a2653e1536f39f4f0bf17f0b53
parentworkspace share path hardening (#95) (diff)
downloadzen-ee5fcbce34eaef87ffced2a993c8443af4af4fe2.tar.xz
zen-ee5fcbce34eaef87ffced2a993c8443af4af4fe2.zip
don't assert that we have moved bytes if source block is zero size (#97)
* don't assert that we have moved bytes if source block is zero size * handle invalid session ids gracefully
-rw-r--r--CHANGELOG.md1
-rw-r--r--src/zenhttp/servers/httpparser.cpp2
-rw-r--r--src/zenhttp/servers/httpsys.cpp2
-rw-r--r--src/zenstore/blockstore.cpp3
4 files changed, 5 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 99a2c5ddb..5d48e9d7c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,6 @@
##
- Bugfix: Absolute paths and paths going outside the root path for workspace shares are now blocked
+- Bugfix: Fix ASSERT that would trigger in GC under certain conditions if source block was empty
- Improvement: `zen workspace-share create` now resolves relative root paths to absolute paths
- Improvement: Add better output/logging when failing to initialize shared mutex
diff --git a/src/zenhttp/servers/httpparser.cpp b/src/zenhttp/servers/httpparser.cpp
index b848a5243..6829faa4a 100644
--- a/src/zenhttp/servers/httpparser.cpp
+++ b/src/zenhttp/servers/httpparser.cpp
@@ -149,7 +149,7 @@ HttpRequestParser::AppendCurrentHeader()
}
else if (HeaderHash == HashSession)
{
- m_SessionId = Oid::FromHexString(HeaderValue);
+ m_SessionId = Oid::TryFromHexString(HeaderValue);
}
else if (HeaderHash == HashRequest)
{
diff --git a/src/zenhttp/servers/httpsys.cpp b/src/zenhttp/servers/httpsys.cpp
index 2b97e3f25..ac17d3ba0 100644
--- a/src/zenhttp/servers/httpsys.cpp
+++ b/src/zenhttp/servers/httpsys.cpp
@@ -1668,7 +1668,7 @@ HttpSysServerRequest::ParseSessionId() const
{
if (Header.RawValueLength == Oid::StringLength)
{
- return Oid::FromHexString({Header.pRawValue, Header.RawValueLength});
+ return Oid::TryFromHexString({Header.pRawValue, Header.RawValueLength});
}
}
}
diff --git a/src/zenstore/blockstore.cpp b/src/zenstore/blockstore.cpp
index 6e289409c..4b650e2d5 100644
--- a/src/zenstore/blockstore.cpp
+++ b/src/zenstore/blockstore.cpp
@@ -1382,7 +1382,8 @@ BlockStore::CompactBlocks(const BlockStoreCompactState& CompactState,
MovedSize += NewBlockSize;
NewBlockFile = nullptr;
- ZEN_ASSERT(!MovedChunks.empty() || RemovedSize > 0); // We should not have a new block if we haven't moved anything
+ ZEN_ASSERT(!MovedChunks.empty() ||
+ (RemovedSize > 0 || OldBlockSize == 0)); // We should not have a new block if we haven't moved anything
ZEN_INFO("{}wrote block {} ({})",
LogPrefix,