From 34c8c53de8ddaff19e81fd1d3c520563c4f39a3b Mon Sep 17 00:00:00 2001 From: Dan Engelbrecht Date: Tue, 5 Aug 2025 09:39:28 +0200 Subject: de/stringbuilder safety (#456) - Improvement: Safeguard FormatCallstack to not throw exceptions when building the callstack string - Improvement: Limit thread name length when setting it for debugger use - Improvemnet: Don't allow assert callbacks to throw exception - Improvement: When formatting log output for malformed attachments in a package message, allow the string buffer to grow instead of throwing exception --- src/zencore/zencore.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/zencore/zencore.cpp') diff --git a/src/zencore/zencore.cpp b/src/zencore/zencore.cpp index 82d28c0e3..51e06ae14 100644 --- a/src/zencore/zencore.cpp +++ b/src/zencore/zencore.cpp @@ -124,7 +124,14 @@ AssertImpl::ExecAssert(const char* Filename, int LineNumber, const char* Functio AssertImpl* AssertImpl = CurrentAssertImpl; while (AssertImpl) { - AssertImpl->OnAssert(Filename, LineNumber, FunctionName, Msg, Callstack); + try + { + AssertImpl->OnAssert(Filename, LineNumber, FunctionName, Msg, Callstack); + } + catch (const std::exception&) + { + // Just keep exception silent - we don't want exception thrown from assert callbacks + } AssertImpl = AssertImpl->NextAssertImpl; } ThrowAssertException(Filename, LineNumber, FunctionName, Msg, Callstack); -- cgit v1.2.3