dolphin/Source/Core/VideoBackends/OGL
Pokechu22 a3951dc2d7 Fix out of bounds accesses for invalid vertex component formats
On all platforms, this would result in out of bounds accesses when getting the component sizes (which uses stuff from VertexLoader_Position.h/VertexLoader_TextCoord.h/VertexLoader_Normal.h). On platforms other than x64 and ARM64, this would also be out of bounds accesses when getting function pointers for the non-JIT vertex loader (in VertexLoader_Position.cpp etc.). Usually both of these would get data from other entries in the same multi-dimensional array, but the last few entries would be truly out of bounds. This does mean that an out of bounds function pointer can be called on platforms that don't have a JIT vertex loader, but it is limited to invalid component formats with values 5/6/7 due to the size of the bitfield the formats come from, so it seems unlikely that this could be exploited in practice.

This issue affects a few games; Def Jam: Fight for New York (https://bugs.dolphin-emu.org/issues/12719) and Fifa Street are known to be affected.

I have not done any hardware testing for this PR specifically, though I *think* I previously determined that at least a value of 5 behaves the same as float (4). That's what I implemented in any case. I did previously determine that both Def Jam: Fight for New York and Fifa Street use an invalid normal format, but don't actually have lighting enabled when that normal vector is used, so it doesn't change rendering in practice.

The color component format also has two invalid values, but VertexLoader_Color.h/.cpp do check for those invalid ones and return a default value instead of doing an out of bounds access.
2024-04-04 12:50:34 -07:00
..
CMakeLists.txt Implement AbstractGfx for OpenGL 2023-01-31 18:46:04 +13:00
GPUTimer.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
OGLBoundingBox.cpp VideoCommon: Use std::span for BoundingBox::Write() 2023-12-09 16:33:21 -05:00
OGLBoundingBox.h VideoCommon: Use std::span for BoundingBox::Write() 2023-12-09 16:33:21 -05:00
OGLConfig.cpp OGLConfig: Only use Warn Log if OGL extensions are missing 2023-11-27 20:52:04 -08:00
OGLConfig.h Merge pull request #11699 from Pokechu22/gl-check-maximum-samples 2023-06-09 15:07:07 +02:00
OGLGfx.cpp VideoBackends: support multiple compute images for some backends (D3D, OGL, Vulkan) 2023-06-28 17:15:31 -05:00
OGLGfx.h VideoBackends: support multiple compute images for some backends (D3D, OGL, Vulkan) 2023-06-28 17:15:31 -05:00
OGLMain.cpp OpenGL: Check the list of supported AA modes instead of hardcoding 2023-06-08 22:07:41 -07:00
OGLNativeVertexFormat.cpp Fix out of bounds accesses for invalid vertex component formats 2024-04-04 12:50:34 -07:00
OGLPerfQuery.cpp Return quarter value for PerfQuery in all backends. 2023-03-14 02:08:20 +01:00
OGLPerfQuery.h Don't set common globals from Video Backends 2023-01-31 19:41:23 +13:00
OGLPipeline.cpp VideoCommon: store the configuration used to create the AbstractPipeline on the pipeline itself, so that it's easy to duplicate pipelines with slightly altered configuration 2023-02-09 02:13:53 -06:00
OGLPipeline.h VideoCommon: store the configuration used to create the AbstractPipeline on the pipeline itself, so that it's easy to duplicate pipelines with slightly altered configuration 2023-02-09 02:13:53 -06:00
OGLShader.cpp OGL: use already known object label lengths 2022-11-01 01:10:03 +00:00
OGLShader.h VideoBackends / VideoCommon: allow the ability to set debug names for shaders / textures. These names are visible in applications like RenderDoc 2021-08-30 13:47:48 -05:00
OGLStreamBuffer.cpp Common/MathUtil: Move IntLog2 into MathUtil namespace 2023-04-15 03:35:05 -04:00
OGLStreamBuffer.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
OGLTexture.cpp VideoBackends / VideoCommon: add type enum to dictate whether a texture is a 2D texture, a texture array, or a cube map; support 2D texture type across backends 2023-12-15 11:06:02 -06:00
OGLTexture.h VideoBackends / VideoCommon: add type enum to dictate whether a texture is a 2D texture, a texture array, or a cube map; support 2D texture type across backends 2023-12-15 11:06:02 -06:00
OGLVertexManager.cpp Implement AbstractGfx for OpenGL 2023-01-31 18:46:04 +13:00
OGLVertexManager.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
ProgramShaderCache.cpp VideoBackends / VideoCommon: add new uniform buffer object for custom shader materials (slot 3, geometry shader buffer moves to slot 4 if available) 2023-10-06 02:17:42 -05:00
ProgramShaderCache.h VideoBackends:OGL: Creating vertex formats shouldn't unbind anything 2022-11-28 21:28:24 -06:00
SamplerCache.cpp Implement AbstractGfx for OpenGL 2023-01-31 18:46:04 +13:00
SamplerCache.h VideoCommon: add constant value to set the allowed maximum number of pixel samplers 2023-02-10 00:46:11 -06:00
VideoBackend.h VideoCommon: Pass WindowSystemInfo to InitBackendInfo 2023-06-08 22:07:39 -07:00