dolphin/Source/Core/VideoBackends/Vulkan
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 VideoBackends:Vulkan: Allow loading custom drivers on Android 2023-06-11 13:52:34 +02:00
CommandBufferManager.cpp VideoBackends: support multiple compute images for some backends (D3D, OGL, Vulkan) 2023-06-28 17:15:31 -05:00
CommandBufferManager.h VideoBackends:Vulkan: Use WorkQueueThread 2023-03-20 16:40:32 +01:00
Constants.h 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
ObjectCache.cpp Revert "VideoCommon: revert max pixel shader samplers back to 8 for Android devices." 2024-01-03 18:43:44 -06:00
ObjectCache.h VideoBackends: add support to allow rendering to multiple output textures 2023-06-03 14:52:31 -05:00
ShaderCompiler.cpp VideoBackends: support multiple compute images for some backends (D3D, OGL, Vulkan) 2023-06-28 17:15:31 -05:00
ShaderCompiler.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
StagingBuffer.cpp VideoBackends:Vulkan: Fix incorrect barriers in StagingBuffer 2022-11-29 23:14:23 +01:00
StagingBuffer.h VideoBackends:Vulkan: Use VMA for staging buffers 2022-10-23 03:21:14 +02:00
StateTracker.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
StateTracker.h VideoBackends: support multiple compute images for some backends (D3D, OGL, Vulkan) 2023-06-28 17:15:31 -05:00
VideoBackend.h VideoCommon: Pass WindowSystemInfo to InitBackendInfo 2023-06-08 22:07:39 -07:00
VKBoundingBox.cpp VideoCommon: Use std::span for BoundingBox::Write() 2023-12-09 16:33:21 -05:00
VKBoundingBox.h VideoCommon: Use std::span for BoundingBox::Write() 2023-12-09 16:33:21 -05:00
VKGfx.cpp VKGfx: Don't panic for VK_SUBOPTIMAL_KHR 2024-01-05 11:20:35 +01:00
VKGfx.h VideoBackends: support multiple compute images for some backends (D3D, OGL, Vulkan) 2023-06-28 17:15:31 -05:00
VKMain.cpp VideoCommon: Pass WindowSystemInfo to InitBackendInfo 2023-06-08 22:07:39 -07:00
VKPerfQuery.cpp Divide by MSAA for PerfQuery in all backends. 2023-03-14 02:13:25 +01:00
VKPerfQuery.h Add virtual Initialize() to PerfQueryBase 2023-01-31 19:41:24 +13:00
VKPipeline.cpp Vulkan: use EnumMap for blend factor luts (NFC) 2023-11-26 00:36:53 +00:00
VKPipeline.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
VKShader.cpp VKShader: Only set shader name if supported 2022-01-31 01:17:40 -05:00
VKShader.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
VKStreamBuffer.cpp VideoBackends:Vulkan: Use VMA for stream buffer 2022-10-23 03:21:29 +02:00
VKStreamBuffer.h VideoBackends:Vulkan: Use VMA for stream buffer 2022-10-23 03:21:29 +02:00
VKSwapChain.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
VKSwapChain.h Vulkan: Remove unused swap chain functions 2022-08-17 18:16:17 -07:00
VKTexture.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
VKTexture.h VideoBackends: add support to allow rendering to multiple output textures 2023-06-03 14:52:31 -05:00
VKVertexFormat.cpp Fix out of bounds accesses for invalid vertex component formats 2024-04-04 12:50:34 -07:00
VKVertexFormat.h Fix build errors related to formatting non-scoped enums 2022-11-23 13:45:43 -08:00
VKVertexManager.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
VKVertexManager.h treewide: convert GPLv2+ license info to SPDX tags 2021-07-05 04:35:56 +02:00
VulkanContext.cpp Video: implement color correction to match the NTSC and PAL color spaces (and gamma) that GC and Wii targeted. 2023-06-19 01:34:42 +03:00
VulkanContext.h VideoBackends:Vulkan: Replace debug_report with debug_utils 2022-12-27 02:48:50 +01:00
VulkanEntryPoints.inl VideoBackends:Vulkan: Replace debug_report with debug_utils 2022-12-27 02:48:50 +01:00
VulkanLoader.cpp VideoBackends:Vulkan: Allow loading custom drivers on Android 2023-06-11 13:52:34 +02:00
VulkanLoader.h VideoBackends:Vulkan: Allow loading custom drivers on Android 2023-06-11 13:52:34 +02:00