Commit graph

13 commits

Author SHA1 Message Date
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 475f218bcd Modified files for SDL2. 2015-01-18 22:52:29 +01:00
Ben Payne dd297d4dc0 Fix buffer overflow 2014-12-13 16:08:38 -05:00
Ben Payne a3f4adacc3 Replace obsolete calling convention 2014-12-11 20:08:45 -05:00
Vincent Gee acb192e2a5 Replaced a ton of ConsoleMethods with the DefineConsoleMethod Macro. 2014-11-03 22:42:51 -05:00
Daniel Buckmaster 2f416290ab Merge pull request #788 from eightyeight/return-status-code
Allow return status to be specified using quitWithStatus
2014-10-24 00:31:05 +11:00
Daniel Buckmaster b01e5668b4 Removed dead unit test code from main loop. 2014-09-29 11:38:32 +10:00
Daniel Buckmaster 9f47032522 Allow return status to be specified using quitWithStatus. 2014-09-24 09:24:29 +10:00
cpusci 4c35fd37af Simple pass over the codebase to standardize the platform types. 2013-08-04 16:26:01 -05:00
DavidWyand-GG 539efcb1e1 Input event changes
- New InputEventManager class.  It will be used by 3rd party input
devices to generate Torque 3D input events.
- Expanded the input event signal to include three new floats and a new
integer.
- Expanded the number of joystick buttons to 48.
- The input virtual map is now extendable rather than hard coded.
- The input devices types are now extendable rather than hard coded.
- New SI_POS, SI_ROT, SI_INT, and SI_FLOAT input event types.
- New SI_VALUE input action type.
- ActionMap has been updated to work with these changes.
- Removed unnecessary references to platform/event.h
2013-01-22 18:17:41 -05:00
DavidWyand-GG 7dbfe6994d Engine directory for ticket #1 2012-09-19 11:15:01 -04:00