Torque3D/Engine/source/gfx
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
..
bitmap Merge remote-tracking branch 'smally/platform_type_consistency' into platform-type-consistency 2014-04-04 13:43:25 +11:00
D3D9 Merge pull request #1096 from bpay/fix-include-guards 2015-01-24 23:02:13 +01:00
gl Remove a get* OpenGL function causing CPU-GPU sync point (bad performance). 2015-01-26 01:56:13 +01:00
Null Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
sim Merge pull request #608 from BeamNG/use_gfxdevice_setupgenericshaders 2014-11-30 02:20:00 +01:00
util Merge pull request #622 from BeamNG/texel_pixel_offset 2014-11-30 02:20:45 +01:00
video Replaced a ton of ConsoleMethods with the DefineConsoleMethod Macro. 2014-11-03 22:42:51 -05:00
genericConstBuffer.cpp Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
genericConstBuffer.h Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
gFont.cpp Fix buffer overflows due to incorrect use of sizeof 2015-01-26 16:52:01 -05:00
gFont.h Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
gfxAdapter.h GFX now handles non-default adapters 2013-04-09 12:50:17 -04:00
gfxAPI.cpp Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
gfxAPI.h Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
gfxCardProfile.cpp Fixes after feedback from Luis. 2014-12-23 18:48:02 +11:00
gfxCardProfile.h Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
gfxCubemap.cpp Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
gfxCubemap.h Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
gfxDebugEvent.h Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
gfxDevice.cpp Fix leaked member var 2014-12-13 16:08:48 -05:00
gfxDevice.h Merge pull request #926 from BeamNG/primbuild_for_non_ffp 2014-11-30 02:21:36 +01:00
gfxDeviceStatistics.cpp Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
gfxDeviceStatistics.h Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
gfxDrawUtil.cpp Fix buffer overflows due to incorrect use of sizeof 2015-01-26 16:52:01 -05:00
gfxDrawUtil.h Allow drawing 2D squares with 0 rotation angle. 2014-07-10 11:30:56 +02:00
gfxEnums.h Set correct terrain layer texture format. 2014-11-08 18:19:14 +01:00
gfxFence.cpp Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
gfxFence.h Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
gfxFontRenderBatcher.cpp Use GFXDevice::setupGenericShaders for support non Fixed Fuction Pipelines. 2014-04-13 17:57:40 +02:00
gfxFontRenderBatcher.h Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
gfxFormatUtils.cpp More fixes 2013-12-04 16:56:26 -05:00
gfxFormatUtils.h Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
gfxInit.cpp GFX now handles non-default adapters 2013-04-09 12:50:17 -04:00
gfxInit.h GFX now handles non-default adapters 2013-04-09 12:50:17 -04:00
gfxOcclusionQuery.cpp Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
gfxOcclusionQuery.h Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
gfxPrimitiveBuffer.cpp Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
gfxPrimitiveBuffer.h Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
gfxResource.cpp Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
gfxResource.h Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
gfxShader.cpp Add GFXShader::init with support for ordered vector of sampler names for shader. 2014-04-17 20:29:44 +02:00
gfxShader.h Add sampler names to ShaderData for use on old versions of OpenGL and Opengl ES2 that not support explicit sampler location on shader files. 2014-11-08 17:50:37 +01:00
gfxStateBlock.cpp Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
gfxStateBlock.h Add OpenGL support. 2014-11-08 20:21:50 +01:00
gfxStringEnumTranslate.cpp Linux implementation. Include changes for gcc x64. 2015-01-24 22:08:26 +01:00
gfxStringEnumTranslate.h Simple pass over the codebase to standardize the platform types. 2013-08-04 16:26:01 -05:00
gfxStructs.cpp Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
gfxStructs.h Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
gfxTarget.cpp Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
gfxTarget.h Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
gfxTextureHandle.cpp Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
gfxTextureHandle.h Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
gfxTextureManager.cpp Merge pull request #612 from GarageGames/platform-type-consistency 2014-05-10 11:40:40 +10:00
gfxTextureManager.h Remove hard coded paths pass 1 2013-01-30 14:09:23 -05:00
gfxTextureObject.cpp Replaced a ton of ConsoleMethods with the DefineConsoleMethod Macro. 2014-11-03 22:42:51 -05:00
gfxTextureObject.h Simple pass over the codebase to standardize the platform types. 2013-08-04 16:26:01 -05:00
gfxTextureProfile.cpp Rename enum GFXTextureProfile::None for avoid conficts on Linux. 2014-04-07 00:03:52 +02:00
gfxTextureProfile.h Rename enum GFXTextureProfile::None for avoid conficts on Linux. 2014-04-07 00:03:52 +02:00
gfxTransformSaver.h Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
gfxVertexBuffer.cpp Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
gfxVertexBuffer.h Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
gfxVertexColor.cpp Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
gfxVertexColor.h Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
gfxVertexFormat.cpp Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
gfxVertexFormat.h Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
gfxVertexTypes.cpp Added PCNTT vertex type. 2014-07-31 00:22:45 +02:00
gfxVertexTypes.h Added PCNTT vertex type. 2014-07-31 00:22:45 +02:00
primBuilder.cpp Fix TAB vs Spaces on Engine/source/gfx/primBuilder.cpp 2014-11-25 22:43:22 +01:00
primBuilder.h Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
screenshot.cpp Engine directory for ticket #1 2012-09-19 11:15:01 -04:00
screenshot.h Fix: Added missing virtual destructors for classes with virtual functions. 2014-05-06 12:40:46 +04:00