Commit graph

46 commits

Author SHA1 Message Date
marauder2k7 d8315267e8 clear utf16 cache
this stops the unicode global cache from showing in the memleak output
2025-05-12 11:50:22 +01:00
marauder2k7 54d0da6690 Update stringFunctions.h
changes to dAtob from az
2024-06-18 15:10:24 +01:00
AzaezelX 0ce2da3a23 clean up math varsize complaints 2023-04-27 16:10:04 -05:00
Robert MacGregor 1b6b803a20 * BugFix: Clear a lot of warnings and correct a few actual programming errors along the way. 2021-10-04 20:04:21 -04:00
Jeff Hutchinson 717c7acca9 Merge remote-tracking branch 'devhead/Preview4_0' into tsneo
# Conflicts:
#	Templates/BaseGame/game/data/ui/guis/loadingGui.gui
#	Templates/BaseGame/game/data/ui/guis/mainMenu.gui
#	Templates/BaseGame/game/tools/MainEditor/guis/MainEditorWindow.gui
#	Templates/BaseGame/game/tools/assetBrowser/guis/assetPreviewButtonsTemplate.gui
#	Templates/BaseGame/game/tools/forestEditor/brushes.tscript
2021-08-13 20:14:39 -04:00
Jeff Hutchinson 2e8a0185b3 Fix buffer overflow issue in StringUnit::getWords.
getWords("a b c d", 2); // "c d"

that turns into this inside the engine:

getWords("a b c d", 2, 1000000);

that code after parsing d goes string++ which passes over the null character. This now enforces that check. Found this with the new script interpreter...how this wasn't blowing up before is beyond me.
2021-06-18 21:08:03 -04:00
Jeff Hutchinson 3e04196a53 make tests pass. 2021-04-03 01:53:40 -04:00
Jeff Hutchinson 35500a87c6 initial port of the new interpreter 2021-03-30 19:33:19 -04:00
Lukas Aldershaab c999baf7ed Moves from using dStrCmp to the new String::compare static functions. Keeps things cleaner, consistent, and works with intellisense. 2020-10-03 14:37:55 +02:00
Areloch ab9fc302fc Added D3D error code interpreter
Added sanity check for findMatch
Finished most of asset importer logic to utilize settings system
Cleaned up code for finding associated files
Added General importer settings category and integrated logic for those settings fields
Updated logic in variableGroup to support callbacks in custom fields
Updated logic in variableInspector to better handle callbacks, as well as being able to manually update when manipulating fields
Updated scripts to utilize project settings values for playGUI and mainMenuGUI names
Improved module-oriented loading of materials
Added util function for populating custom fonts
2019-08-12 01:04:17 -05:00
Glenn Smith 47d5b6ead7 As suggested, extract strlen calls from sizes into variables so it isn't called twice 2018-03-08 20:59:40 -05:00
Glenn Smith a061923c1e Better to use strlcat and strlcpy and move them to the cpp file. Provided an implementation for platforms that don't support them (macOS only currently) 2018-03-08 00:45:24 -05:00
Glenn Smith a46cadc487 Let dStrncat use strncat because it's probably set up for that 2018-03-07 03:58:28 -05:00
Glenn Smith 396fe5b0ad Cleaning up the checks 2018-03-06 02:37:42 -05:00
Glenn Smith 79c34c68db Use strncpy instead of strcpy because again, buffer overflows 2018-03-06 02:35:33 -05:00
Glenn Smith 7769da9434 Use strncat instead of strcat to prevent some buffer overflows 2018-03-06 00:48:44 -05:00
Phillip Khandeliants 1b4f238a25 Fixed V610: Undefined behavior
In an arithmetic expression, all the variables whose values can be represented with type 'int' will be promoted to this type. Therefore, the result of the '~mask' expression is a negative number. By the C++ standard, shifting a negative number to the left leads to an undefined behavior.
2017-04-27 12:13:05 +03:00
Areloch ed14b6fced Removes bits of code and includes that are based on old 360, xbox and PS3 flags that are no longer needed. 2017-04-08 20:30:57 -05:00
Azaezel c57b1a8b70 clang reports: unclear || + && and &+| mixes. 2016-10-14 17:26:13 -05:00
Anis 794f1b9536 Merge pull request #1532 from GarageGames/pr/1143
[CLONE] More consolefunctions #1143
2016-02-26 18:57:49 +01:00
Raul Ferriz a5d34271f2 Fixed some minor compiler warnings on Linux 2015-06-28 22:29:23 +02:00
Ben Payne f67a0353d0 Review fixes 2015-02-23 14:57:37 -05:00
Ben Payne 55ac3dca70 Fix assignment operator 2015-02-20 18:42:30 -05:00
Ben Payne 591253d5b5 Fix missing va_end's 2015-02-20 18:42:29 -05:00
Nathan Bowhay 2e7018bf68 Added type conversions to fix compile errors
Added two type conversions that were missing in order to fix some
compile errors.
2015-02-11 10:55:30 -08:00
Ben Payne 47950382f7 ...and update the profiler strings 2015-01-26 16:52:07 -05:00
Ben Payne fcf52fb5e0 Rename the memory allocating versions to make prev error less likely
The behavior is different enough that these shouldn't be overloaded
with the non-allocating verions. Also makes it more obvious what is
going on to the caller.
2015-01-26 16:52:06 -05:00
Ben Payne 6e45643b28 Add descriptions 2015-01-26 16:52:04 -05:00
Ben Payne 2cc4801974 Remove a dead function 2015-01-26 16:52:03 -05:00
Ben Payne 7613fa0375 Remove unnecessary null termination
UTF16Cache::copyToBuffer() is already adding a null terminator
2015-01-26 16:52:02 -05:00
Ben Payne e3bbc42925 Provide a safer version of convertUTF16toUTF8 2015-01-26 16:52:01 -05:00
Ben Payne a88339c219 Fix buffer overflows due to incorrect use of sizeof
A snippet of example code:

UTF16 pszFilter[1024];
...
convertUTF8toUTF16((UTF8 *)mData.mFilters, pszFilter, sizeof(pszFilter));

Since the conversion function is expecting the third parameter to be the
length in 16-bit characters, *not* bytes, this results in the function
writing outside the bounds of the output array.

To make this less likely to happen in the future (I hope), I've provided a
template function that infers the correct size of a static array, so it's
no longer necessary to pass the size in most cases. The sized function has
been renamed with an "N" suffix to hopefully encourage this use.

This bug was caught due to a warning from MSVC about stack corruption
occurring in codeBlock::exec(), after opening a file open dialog twice in
succession. After some hunting, I found that this was due to
FileDialog::Execute() passing incorrect buffer sizes to the conversion
function, which resulted in the function writing a null terminator into
some memory that happened to be in the stack frame of codeBlock::exec()!
2015-01-26 16:52:01 -05:00
Luis Anton Rebollo 6492028bb2 Merge pull request #1035 from bpay/memfixes
Memfixes
2015-01-25 13:42:32 +01:00
LuisAntonRebollo 3336bffad2 Changes for Linux. 2015-01-19 01:44:36 +01:00
Daniel Buckmaster 3ab048c5b0 Fixes after feedback from Luis.
* Made use of dStrIsEmpty in more locations (and fixed it :P)
 * Removed commented-out code
 * Corrected default params
 * Fixed some console warning formats
 * Removed tabs
 * Corrected setExtent API
2014-12-23 18:48:02 +11:00
Daniel Buckmaster 03f71a78c0 Added dStrIsEmpty and replaced some incorrect string comparisons. 2014-12-21 21:25:19 +11:00
Ben Payne a10e6e99d4 Fix read past end of array 2014-12-11 18:22:14 -05:00
Daniel Buckmaster 33444e8a36 Added string functions from T2D. 2014-06-16 12:39:51 +10:00
Daniel Buckmaster 1702573b78 Merge pull request #612 from GarageGames/platform-type-consistency
Platform type consistency
2014-05-10 11:40:40 +10:00
Daniel Buckmaster 87d9e245b7 Merge remote-tracking branch 'smally/platform_type_consistency' into platform-type-consistency
Conflicts:
	Engine/source/platform/platformCPUCount.cpp
2014-04-04 13:43:25 +11:00
Azaezel 59c755b5e5 Minimal requisite alterations for development head as of 02APR2014 for compilation purposes on VS2013. 2014-04-02 15:09:07 -05:00
Thomas Fischer 29d7fe310d Merge pull request #583 from tdev/x64_basics
windows 64 bit basics
2014-03-18 00:51:58 +01:00
Thomas Fischer 6d8e0d7e25 refactored platform precompiler variable: TORQUE_OS_WIN{32,64,} 2014-03-15 15:10:14 +01:00
Thomas Fischer 502e346eb6 visual studio 2012 Level 4 warning fixes 2014-03-15 11:38:53 +01:00
cpusci 4c35fd37af Simple pass over the codebase to standardize the platform types. 2013-08-04 16:26:01 -05:00
DavidWyand-GG 7dbfe6994d Engine directory for ticket #1 2012-09-19 11:15:01 -04:00