aboutsummaryrefslogtreecommitdiff
path: root/src/zencore/include
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2023-12-19 10:54:11 +0100
committerGitHub <[email protected]>2023-12-19 10:54:11 +0100
commita8c4854f60d72d083bd34b34a9ccccc7353d052c (patch)
treeb67f14491390e81142f8293a20bc200be58c3fbb /src/zencore/include
parentfix ChunkIndexToChunkHash indexing (#621) (diff)
downloadzen-a8c4854f60d72d083bd34b34a9ccccc7353d052c.tar.xz
zen-a8c4854f60d72d083bd34b34a9ccccc7353d052c.zip
various TSAN/ASAN/LeakAnalyzer fixes (#622)
* fix JobQueue test threading issue. The inner job queued with `QueueJob` would reference `I` from inside the captured closure which would subsequently disappear * made sure application exit is thread safe * don't try to access string data out of bounds * keep-alive flag is accessed from multiple threads * fix memory leaks in Zen upstream client code * TSAN fixes for Event
Diffstat (limited to 'src/zencore/include')
-rw-r--r--src/zencore/include/zencore/string.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/zencore/include/zencore/string.h b/src/zencore/include/zencore/string.h
index 3aec1647d..b0232d883 100644
--- a/src/zencore/include/zencore/string.h
+++ b/src/zencore/include/zencore/string.h
@@ -638,7 +638,12 @@ ToHexNumber(UnsignedIntegral auto Value, char* OutString)
bool
ParseHexNumber(const std::string_view HexString, UnsignedIntegral auto& OutValue)
{
- return ParseHexNumber(HexString.data(), sizeof(OutValue) * 2, (uint8_t*)&OutValue);
+ size_t ExpectedCharacterCount = sizeof(OutValue) * 2;
+ if (HexString.size() != ExpectedCharacterCount)
+ {
+ return false;
+ }
+ return ParseHexNumber(HexString.data(), ExpectedCharacterCount, (uint8_t*)&OutValue);
}
//////////////////////////////////////////////////////////////////////////