diff --git a/Changelog.txt b/Changelog.txt index 39aa64bb4..460974ebf 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -3346,7 +3346,7 @@ Additionally, the problem of zig-zag issue following in the South direction has - Fixed: Client Linger Timer is 3600 seconds on stoned players. (Issue #1081) 23-09-2023, Jhobean -Fixed: When deleting account, f_onchar_delete was not call on char and char's item was not remove causing warning on next server boot. ( Issue #1029) +- Fixed: When deleting account, f_onchar_delete was not call on char and char's item was not removed causing warning on next server boot. (Issue #1029) 07-10-2023, Nolok - Added: FUNC keyword to item templates and template-triggers with special parsing (@Create, @CreateLoot, @NPCRestock). It allows to call a function with arguments on the last created ITEM. diff --git a/cmake/toolchains/Linux-Clang_common.inc.cmake b/cmake/toolchains/Linux-Clang_common.inc.cmake index 2446180b8..2557d12ed 100644 --- a/cmake/toolchains/Linux-Clang_common.inc.cmake +++ b/cmake/toolchains/Linux-Clang_common.inc.cmake @@ -24,7 +24,8 @@ function (toolchain_exe_stuff_common) IF (${USE_UBSAN}) SET (UBSAN_FLAGS "-fsanitize=undefined,\ shift,integer-divide-by-zero,vla-bound,null,signed-integer-overflow,bounds-strict,\ -float-divide-by-zero,float-cast-overflow,pointer-overflow") +float-divide-by-zero,float-cast-overflow,pointer-overflow \ +-fno-sanitize=enum") SET (C_FLAGS_EXTRA "${C_FLAGS_EXTRA} ${UBSAN_FLAGS}") SET (CXX_FLAGS_EXTRA "${CXX_FLAGS_EXTRA} ${UBSAN_FLAGS} -fsanitize=return,vptr") SET (ENABLED_SANITIZER true) diff --git a/cmake/toolchains/Linux-GNU_common.inc.cmake b/cmake/toolchains/Linux-GNU_common.inc.cmake index 3e46786b4..6432a3bd7 100644 --- a/cmake/toolchains/Linux-GNU_common.inc.cmake +++ b/cmake/toolchains/Linux-GNU_common.inc.cmake @@ -24,7 +24,8 @@ function (toolchain_exe_stuff_common) IF (${USE_UBSAN}) SET (UBSAN_FLAGS "-fsanitize=undefined,\ shift,integer-divide-by-zero,vla-bound,null,signed-integer-overflow,bounds-strict,\ -float-divide-by-zero,float-cast-overflow,pointer-overflow") +float-divide-by-zero,float-cast-overflow,pointer-overflow \ +-fno-sanitize=enum") SET (C_FLAGS_EXTRA "${C_FLAGS_EXTRA} ${UBSAN_FLAGS}") SET (CXX_FLAGS_EXTRA "${CXX_FLAGS_EXTRA} ${UBSAN_FLAGS} -fsanitize=return,vptr") SET (ENABLED_SANITIZER true) diff --git a/cmake/toolchains/OSX-AppleClang_common.inc.cmake b/cmake/toolchains/OSX-AppleClang_common.inc.cmake index 1265e1b9b..763bf4eb9 100644 --- a/cmake/toolchains/OSX-AppleClang_common.inc.cmake +++ b/cmake/toolchains/OSX-AppleClang_common.inc.cmake @@ -24,7 +24,8 @@ function (toolchain_exe_stuff_common) IF (${USE_UBSAN}) SET (UBSAN_FLAGS "-fsanitize=undefined,\ shift,integer-divide-by-zero,vla-bound,null,signed-integer-overflow,bounds-strict,\ -float-divide-by-zero,float-cast-overflow,pointer-overflow") +float-divide-by-zero,float-cast-overflow,pointer-overflow \ +-fno-sanitize=enum") SET (C_FLAGS_EXTRA "${C_FLAGS_EXTRA} ${UBSAN_FLAGS}") SET (CXX_FLAGS_EXTRA "${CXX_FLAGS_EXTRA} ${UBSAN_FLAGS} -fsanitize=return,vptr") SET (ENABLED_SANITIZER true) diff --git a/cmake/toolchains/Windows-Clang_common.inc.cmake b/cmake/toolchains/Windows-Clang_common.inc.cmake index a9a9c5d20..ae7f1b95c 100644 --- a/cmake/toolchains/Windows-Clang_common.inc.cmake +++ b/cmake/toolchains/Windows-Clang_common.inc.cmake @@ -22,13 +22,13 @@ function (toolchain_exe_stuff_common) SET (EXE_LINKER_EXTRA "") IF (CLANG_USE_GCC_LINKER) - SET (CLANG_SUBSYSTEM_PREFIX "-m") + SET (CLANG_SUBSYSTEM_PREFIX "-m --entry=WinMainCRTStartup") ELSE () SET (CLANG_SUBSYSTEM_PREFIX "-Xlinker /subsystem:") ENDIF() - IF (${WIN32_SPAWN_CONSOLE} EQUAL TRUE) - SET (EXE_LINKER_EXTRA "${EXE_LINKER_EXTRA} ${CLANG_SUBSYSTEM_PREFIX}console") + IF (${WIN32_SPAWN_CONSOLE}) + SET (EXE_LINKER_EXTRA "${EXE_LINKER_EXTRA} ${CLANG_SUBSYSTEM_PREFIX}console -Xlinker /ENTRY:WinMainCRTStartup") SET (PREPROCESSOR_DEFS_EXTRA "_WINDOWS_CONSOLE") ELSE () SET (EXE_LINKER_EXTRA "${EXE_LINKER_EXTRA} ${CLANG_SUBSYSTEM_PREFIX}windows") @@ -48,14 +48,15 @@ function (toolchain_exe_stuff_common) ENDIF () IF (${USE_UBSAN}) SET (UBSAN_FLAGS "-fsanitize=undefined,\ -#shift,integer-divide-by-zero,vla-bound,null,signed-integer-overflow,bounds-strict,\ -#float-divide-by-zero,float-cast-overflow,pointer-overflow") +shift,integer-divide-by-zero,vla-bound,null,signed-integer-overflow,bounds,\ +float-divide-by-zero,float-cast-overflow,pointer-overflow \ +-fno-sanitize=enum") SET (C_FLAGS_EXTRA "${C_FLAGS_EXTRA} ${UBSAN_FLAGS}") - SET (CXX_FLAGS_EXTRA "${CXX_FLAGS_EXTRA} ${UBSAN_FLAGS} -fsanitize=return,vptr") + SET (CXX_FLAGS_EXTRA "${CXX_FLAGS_EXTRA} ${UBSAN_FLAGS} -fsanitize=return") SET (ENABLED_SANITIZER true) ENDIF () IF (${ENABLED_SANITIZER}) - SET (PREPROCESSOR_DEFS_EXTRA "${PREPROCESSOR_DEFS_EXTRA} _SANITIZERS") + SET (PREPROCESSOR_DEFS_EXTRA ${PREPROCESSOR_DEFS_EXTRA} _SANITIZERS) ENDIF () diff --git a/cmake/toolchains/Windows-GNU_common.inc.cmake b/cmake/toolchains/Windows-GNU_common.inc.cmake index 3a2facf59..0e916a5f6 100644 --- a/cmake/toolchains/Windows-GNU_common.inc.cmake +++ b/cmake/toolchains/Windows-GNU_common.inc.cmake @@ -11,7 +11,7 @@ endfunction () function (toolchain_exe_stuff_common) SET (EXE_LINKER_EXTRA "") - IF (${WIN32_SPAWN_CONSOLE} EQUAL TRUE) + IF (${WIN32_SPAWN_CONSOLE}) SET (EXE_LINKER_EXTRA "${EXE_LINKER_EXTRA} -mconsole") SET (PREPROCESSOR_DEFS_EXTRA "_WINDOWS_CONSOLE") #ELSE () @@ -35,7 +35,8 @@ function (toolchain_exe_stuff_common) MESSAGE (FATAL_ERROR "MinGW-GCC doesn't yet support UBSAN") #SET (UBSAN_FLAGS "-fsanitize=undefined,\ #shift,integer-divide-by-zero,vla-bound,null,signed-integer-overflow,bounds-strict,\ -#float-divide-by-zero,float-cast-overflow,pointer-overflow") +#float-divide-by-zero,float-cast-overflow,pointer-overflow \ +#-fno-sanitize=enum") #SET (C_FLAGS_EXTRA "${C_FLAGS_EXTRA} ${UBSAN_FLAGS}") #SET (CXX_FLAGS_EXTRA "${CXX_FLAGS_EXTRA} ${UBSAN_FLAGS} -fsanitize=return,vptr") #SET (ENABLED_SANITIZER true) diff --git a/src/game/clients/CClientMsg.cpp b/src/game/clients/CClientMsg.cpp index ca39841ca..f9bf07068 100644 --- a/src/game/clients/CClientMsg.cpp +++ b/src/game/clients/CClientMsg.cpp @@ -290,14 +290,14 @@ void CClient::closeUIWindow( const CObjBase* pObj, PacketCloseUIWindow::UIWindow void CClient::addObjectRemove( const CUID& uid ) const { - ADDTOCALLSTACK("CClient::addObjectRemove"); + ADDTOCALLSTACK("CClient::addObjectRemove (CUID)"); // Tell the client to remove the item or char new PacketRemoveObject(this, uid); } void CClient::addObjectRemove( const CObjBase * pObj ) const { - ADDTOCALLSTACK("CClient::addObjectRemove"); + ADDTOCALLSTACK("CClient::addObjectRemove (CObjBase)"); addObjectRemove( pObj->GetUID()); } diff --git a/src/game/items/CItemContainer.cpp b/src/game/items/CItemContainer.cpp index 9d1f3801f..bcc7f9dcc 100644 --- a/src/game/items/CItemContainer.cpp +++ b/src/game/items/CItemContainer.cpp @@ -586,7 +586,7 @@ void CItemContainer::ContentAdd( CItem *pItem, CPointMap pt, bool bForceNoStack, // Try drop it on given container grid index (if not available, drop it on next free index) { - bool fGridCellUsed[UCHAR_MAX] {false}; + bool fGridCellUsed[UCHAR_MAX + 1] {false}; for (const CSObjContRec* pObjRec : *this) { const CItem* pTry = static_cast(pObjRec); @@ -600,7 +600,7 @@ void CItemContainer::ContentAdd( CItem *pItem, CPointMap pt, bool bForceNoStack, if (fGridCellUsed[gridIndex]) { gridIndex = 0; - for (uint i = 0; i < UCHAR_MAX; ++i) + for (uint i = 0; (i < UCHAR_MAX) && (gridIndex < UCHAR_MAX); ++i) { if (!fGridCellUsed[i]) break;