Skip to content

Commit 8e4a634

Browse files
Synchronize changes from 1.6 master branch [ci skip]
778207b Fix heap corruption crash (No dialog) @ GTA SA 0x4fc66f: Engine sound type 4: Accelerate or type 5/Gear change 71ab849 Addendum to 651cea5
2 parents aac8b42 + 778207b commit 8e4a634

File tree

2 files changed

+11
-21
lines changed

2 files changed

+11
-21
lines changed

Client/core/CrashHandler.cpp

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -708,31 +708,21 @@ void __cdecl AbortSignalHandler([[maybe_unused]] int signal) noexcept
708708
CONTEXT* pCtx = nullptr;
709709
EXCEPTION_POINTERS exPtrs{};
710710

711-
if (BuildExceptionContext(exPtrs, pExRecord, pCtx, EXCEPTION_NONCONTINUABLE_EXCEPTION))
711+
PFNCHFILTFN callback = g_pfnCrashCallback.load(std::memory_order_acquire);
712+
713+
if (callback != nullptr && BuildExceptionContext(exPtrs, pExRecord, pCtx, EXCEPTION_NONCONTINUABLE_EXCEPTION))
712714
{
713-
PFNCHFILTFN callback = g_pfnCrashCallback.load(std::memory_order_acquire);
714-
if (callback != nullptr)
715-
{
716-
LogHandlerEvent(DEBUG_PREFIX_PURECALL, "Calling crash handler callback");
715+
LogHandlerEvent(DEBUG_PREFIX_PURECALL, "Calling crash handler callback");
717716

718-
try
719-
{
720-
callback(&exPtrs);
721-
}
722-
catch (...)
723-
{
724-
LogHandlerEvent(DEBUG_PREFIX_PURECALL, "Exception in crash handler callback");
725-
}
717+
try
718+
{
719+
callback(&exPtrs);
726720
}
727-
else
721+
catch (...)
728722
{
729-
LogHandlerEvent(DEBUG_PREFIX_PURECALL, "No crash handler callback available");
723+
LogHandlerEvent(DEBUG_PREFIX_PURECALL, "Exception in crash handler callback");
730724
}
731725
}
732-
else
733-
{
734-
LogHandlerEvent(DEBUG_PREFIX_PURECALL, "Failed to allocate exception structures");
735-
}
736726

737727
if (pCtx != nullptr)
738728
{
@@ -1346,7 +1336,7 @@ static bool BuildExceptionContext(EXCEPTION_POINTERS& outExPtrs, EXCEPTION_RECOR
13461336

13471337
PFNCHFILTFN callback = g_pfnCrashCallback.load(std::memory_order_acquire);
13481338

1349-
if (BuildExceptionContext(exPtrs, pExRecord, pCtx, CPP_EXCEPTION_CODE) && callback != nullptr)
1339+
if (callback != nullptr && BuildExceptionContext(exPtrs, pExRecord, pCtx, CPP_EXCEPTION_CODE))
13501340
{
13511341
SafeDebugOutput(DEBUG_PREFIX_CPP "Calling crash handler callback\n");
13521342

Client/mods/deathmatch/logic/CClientSound.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ class CClientSound final : public CClientEntity
127127
static AudioBufferDeleter ForExternalReference() noexcept { return AudioBufferDeleter(&NoopImpl); }
128128

129129
private:
130-
static void DeleteArrayImpl(void* ptr) noexcept { ::operator delete[](ptr); }
130+
static void DeleteArrayImpl(void* ptr) noexcept { delete[] static_cast<uint8_t*>(ptr); }
131131
static void FreeImpl(void* ptr) noexcept { std::free(ptr); }
132132
static void NoopImpl(void*) noexcept {}
133133

0 commit comments

Comments
 (0)