From 3dc9f8c92d68011a4be21d248bc207045485fc88 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Sun, 17 Apr 2022 00:45:13 +0700 Subject: [PATCH 1/3] Fixed typo ZONE_DYNAMIC_SIZE --- rehlds/engine/zone.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rehlds/engine/zone.h b/rehlds/engine/zone.h index 46dcd22..8c7b437 100644 --- a/rehlds/engine/zone.h +++ b/rehlds/engine/zone.h @@ -30,7 +30,7 @@ #include "maintypes.h" -#define ZONE_DYNAMIC_SIZE 0x20000 +#define ZONE_DYNAMIC_SIZE 0x200000 typedef struct memblock_s memblock_t; typedef struct memzone_s memzone_t; From be0e1c843be91bcbbafd5095fd4328f49f64bb39 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Wed, 25 May 2022 18:39:14 +0700 Subject: [PATCH 2/3] Fix null or empty input string in COM_LoadFile (FS_Open with input empty string "" will succeed on some POSIX systems) Resolved #919 --- rehlds/engine/common.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rehlds/engine/common.cpp b/rehlds/engine/common.cpp index fa1facb..badf993 100644 --- a/rehlds/engine/common.cpp +++ b/rehlds/engine/common.cpp @@ -1995,6 +1995,9 @@ int EXT_FUNC COM_FileSize(const char *filename) unsigned char* EXT_FUNC COM_LoadFile(const char *path, int usehunk, int *pLength) { + if (!path || !path[0]) + return NULL; + char base[MAX_PATH]; unsigned char *buf = NULL; From e9045e3b6359d8bf2c2f4c0d57e4f7ff129beb2c Mon Sep 17 00:00:00 2001 From: s1lentq Date: Sun, 10 Jul 2022 15:47:56 +0700 Subject: [PATCH 3/3] Fixed: StripUnprintableWorker did not count the null terminator --- rehlds/engine/unicode_strtools.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rehlds/engine/unicode_strtools.cpp b/rehlds/engine/unicode_strtools.cpp index 275c9af..385cee9 100644 --- a/rehlds/engine/unicode_strtools.cpp +++ b/rehlds/engine/unicode_strtools.cpp @@ -461,7 +461,7 @@ static uchar16 *StripWhitespaceWorker(uchar16 *pwch, int cchLength, bool *pbStri // walk backwards from the end of the string, killing any whitespace *pbStrippedWhitespace = false; - uchar16 *pwchEnd = pwch + cchLength; + uchar16 *pwchEnd = pwch + cchLength - 1; while (--pwchEnd >= pwch) { if (!iswspace(*pwchEnd) && !Q_IsMeanSpaceW(*pwchEnd)) @@ -505,7 +505,7 @@ uchar16 *__cdecl StripUnprintableWorker(uchar16 *pwch, int *pLength, bool *pStri *pStripped = rPos != wPos; if (*pStripped) - *pLength = wPos - pwch; + *pLength = (wPos - pwch) + 1; // null termination return pwch; }