dolphin/Source/Core/VideoCommon
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
..
Assets Merge pull request #12457 from iwubcode/asset_memory_limit 2024-02-16 15:46:52 -05:00
GraphicsModSystem VideoCommon: move factory names to be a static inside each action class, so that they can be reused in the future for serialization 2024-02-18 15:45:10 -06:00
AbstractFramebuffer.cpp VideoBackends: add support to allow rendering to multiple output textures 2023-06-03 14:52:31 -05:00
AbstractFramebuffer.h AbstractFramebuffer: Fix Android reorder-ctor warning 2023-08-12 20:48:47 -07:00
AbstractGfx.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
AbstractGfx.h VideoBackends: support multiple compute images for some backends (D3D, OGL, Vulkan) 2023-06-28 17:15:31 -05:00
AbstractPipeline.h Fix uninitialized variable warnings (C26495) 2023-02-15 19:18:39 -08:00
AbstractShader.h
AbstractStagingTexture.cpp
AbstractStagingTexture.h
AbstractTexture.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
AbstractTexture.h VideoCommon: move texture dump function out of texture cache to its own free function so it can be used elsewhere. Doing this change may also slightly improve performance of this operation 2023-11-26 16:35:03 -06:00
AsyncRequests.cpp VideoCommon/Fifo: Pass system instance through FifoManager constructor 2023-12-18 22:03:25 -05:00
AsyncRequests.h
AsyncShaderCompiler.cpp
AsyncShaderCompiler.h
BoundingBox.cpp VideoCommon: Use std::span for BoundingBox::Write() 2023-12-09 16:33:21 -05:00
BoundingBox.h VideoCommon: Use std::span for BoundingBox::Write() 2023-12-09 16:33:21 -05:00
BPFunctions.cpp Move SmallVector to Common 2023-08-22 13:19:49 +02:00
BPFunctions.h
BPMemory.cpp VideoCommon: copy software renderer logic for blend mode priorities 2023-11-12 05:51:28 +00:00
BPMemory.h Add descriptions for more BP registers 2023-11-11 23:32:17 -08:00
BPStructs.cpp VideoCommon/Statistics: Remove global system accessor from s_after_frame_event 2024-01-31 13:12:09 -05:00
BPStructs.h
CMakeLists.txt VideoCommon: add functionality to prepare for a mesh asset that is loaded from a GLTF file 2024-02-11 13:28:00 -06:00
CommandProcessor.cpp Migrate SConfig::bWii to System. 2024-01-31 12:54:07 +01:00
CommandProcessor.h Migrate SConfig::bWii to System. 2024-01-31 12:54:07 +01:00
ConstantManager.h VideoCommon: add milliseconds elapsed time value to pixel shaders as a uniform to be able to support animation effects in custom shaders 2023-08-20 18:53:27 -05:00
Constants.h Revert "VideoCommon: revert max pixel shader samplers back to 8 for Android devices." 2024-01-03 18:43:44 -06:00
CPMemory.cpp Migrate SConfig::bWii to System. 2024-01-31 12:54:07 +01:00
CPMemory.h Fix out of bounds accesses for invalid vertex component formats 2024-04-04 12:50:34 -07:00
CPUCull.cpp VideoCommon: move xf state management to its own class, so changes can be detected in places other than VertexShaderManager 2023-11-26 16:27:26 -06:00
CPUCull.h Fix uninitialized variable warnings (C26495) 2023-02-15 19:18:39 -08:00
CPUCullImpl.h VideoCommon: Add class for quickly transforming and culling vertices on the CPU 2023-01-25 02:21:56 -06:00
DataReader.h
DriverDetails.cpp Remove out-dated hack of AMD driver issue WRT dual-source blending output index. 2023-08-15 23:58:29 -04:00
DriverDetails.h Remove out-dated hack of AMD driver issue WRT dual-source blending output index. 2023-08-15 23:58:29 -04:00
Fifo.cpp VideoCommon/CommandProcessor: Pass system instance through constructor 2023-12-20 09:02:53 -05:00
Fifo.h VideoCommon/Fifo: Pass system instance through FifoManager constructor 2023-12-18 22:03:25 -05:00
FramebufferManager.cpp VideoCommon/Statistics: Remove global system accessor from s_after_frame_event 2024-01-31 13:12:09 -05:00
FramebufferManager.h Video: Make the game resolution (within the window) snap to the XFB size if they are within a ~1 pixel treshold on one axis only. 2024-02-20 03:09:11 +02:00
FramebufferShaderGen.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
FramebufferShaderGen.h 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
FrameDumper.cpp VideoCommon/Statistics: Remove global system accessor from s_after_frame_event 2024-01-31 13:12:09 -05:00
FrameDumper.h Apply suggestions from code review 2023-02-09 18:36:20 +13:00
FrameDumpFFMpeg.cpp Core/SystemTimers: Refactor to class, move to System. 2024-01-04 23:35:19 +01:00
FrameDumpFFMpeg.h Fix builds with FFMPEG disabled 2023-02-09 18:36:20 +13:00
FreeLookCamera.cpp
FreeLookCamera.h
GeometryShaderGen.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
GeometryShaderGen.h
GeometryShaderManager.cpp VideoCommon: De-globalize GeometryShaderManager class. 2022-12-29 15:33:19 +01:00
GeometryShaderManager.h VideoCommon: De-globalize GeometryShaderManager class. 2022-12-29 15:33:19 +01:00
GXPipelineTypes.h VideoCommon: given the changes to pipeline interaction, update the global version variable to reflect those changes and force pipelines to be rebuilt 2023-10-06 02:17:43 -05:00
HiresTextures.cpp VideoCommon: instead of using 'CustomTextureData' directly, use 'TextureData' for texture assets, this allows us to provide additional metadata for textures. Such as a sampler or type information (to distinguish cube maps) 2023-10-10 09:58:14 -05:00
HiresTextures.h Core / VideoCommon: update HiresTexture to use CustomAssetLoader 2023-06-05 16:33:19 -05:00
IndexGenerator.cpp IndexGenerator: Fix off-by-one in GetRemainingIndices 2023-01-04 10:42:00 -08:00
IndexGenerator.h VideoCommon: Add vertex shader point and line expansion 2022-10-22 20:13:24 -05:00
LightingShaderGen.cpp LightingShaderGen: Resolve -Wshadow warnings 2023-12-12 16:55:06 -05:00
LightingShaderGen.h VideoCommon: add helper functions to handle generating custom lighting code for a custom pixel shader 2023-08-20 18:53:27 -05:00
LookUpTables.h
NativeVertexFormat.h NativeVertexFormat: Collapse std namespace and mark hash noexcept 2024-01-31 12:37:44 -05:00
NetPlayChatUI.cpp VideoCommon: update NetplayChatUI's chat message input to use a hidden label. This avoids an error thrown by imgui 2023-07-29 00:27:07 -05:00
NetPlayChatUI.h
NetPlayGolfUI.cpp
NetPlayGolfUI.h
OnScreenDisplay.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
OnScreenDisplay.h VideoCommon: Add support for icons in OSD messages. 2023-10-17 02:47:29 +02:00
OnScreenUI.cpp Core/Movie: Refactor to class, move to System. 2024-01-15 08:05:30 +01:00
OnScreenUI.h Display Active Challenges On Screen 2023-12-07 16:02:15 -05:00
OnScreenUIKeyMap.h Insert a more solid abstraction between Qt and Imgui 2023-02-09 18:36:20 +13:00
OpcodeDecoding.cpp FifoRecorder: Move instance to System. 2024-01-12 15:06:06 +01:00
OpcodeDecoding.h VideoCommon: add message to XF load assert 2023-12-12 22:35:02 +00:00
PerformanceMetrics.cpp HW/VideoInterface: Refactor to class. 2023-03-11 12:50:35 +01:00
PerformanceMetrics.h Fix uninitialized variable warnings (C26495) 2023-02-15 19:18:39 -08:00
PerformanceTracker.cpp PerformanceTracker: Add ownership of m_log_name. 2023-01-06 20:27:25 +01:00
PerformanceTracker.h PerformanceTracker: Add ownership of m_log_name. 2023-01-06 20:27:25 +01:00
PerfQueryBase.cpp
PerfQueryBase.h Add virtual Initialize() to PerfQueryBase 2023-01-31 19:41:24 +13:00
PixelEngine.cpp VideoCommon/PixelEngine: Generify lock guards 2023-12-22 14:19:29 -05:00
PixelEngine.h VideoCommon/PixelEngine: Passthrough system instance in constructor 2023-12-22 14:19:26 -05:00
PixelShaderGen.cpp VideoCommon: Don't use indexed output for fbfetch 2024-02-07 03:52:31 +01:00
PixelShaderGen.h VideoCommon: prepare graphics mods for custom shader material data 2023-12-12 17:56:26 -06:00
PixelShaderManager.cpp Make sure pixel shaders pick up Initial EFB Scale 2023-02-09 18:36:20 +13:00
PixelShaderManager.h VideoCommon: add custom pixel shader constants as a buffer of data to be passed to all backends 2023-10-05 21:20:16 -05:00
PostProcessing.cpp PostProcessing: Don't potentially leak memory in BlitFromTexture() 2024-01-23 13:34:40 -05:00
PostProcessing.h Video: fix post process shaders with parameters failing to build on OpenGL 2023-08-18 02:00:56 +03:00
Present.cpp Add custom relative and raw (squared pixels) aspect ratio modes 2024-02-29 21:11:19 +02:00
Present.h Video: Make the game resolution (within the window) snap to the XFB size if they are within a ~1 pixel treshold on one axis only. 2024-02-20 03:09:11 +02:00
RenderBase.cpp Move UseVertexDepthRange() out of Renderer 2023-02-09 18:36:20 +13:00
RenderBase.h Cleanup headers 2023-02-09 18:36:20 +13:00
RenderState.cpp VideoCommon: copy software renderer logic for blend mode priorities 2023-11-12 05:51:28 +00:00
RenderState.h RenderState: Collapse std namespace for hash 2024-01-31 12:40:10 -05:00
sfont.inc
ShaderCache.cpp VideoCommon/Statistics: Remove global system accessor from s_after_frame_event 2024-01-31 13:12:09 -05:00
ShaderCache.h Common/LinearDiskCache: Move interface into Common namespace 2023-04-19 09:14:39 -04:00
ShaderGenCommon.cpp VideoCommon: Fix custom shader constants on GLES 2023-08-22 19:38:18 +02:00
ShaderGenCommon.h VideoCommon: prepare graphics mods for custom shader material data 2023-12-12 17:56:26 -06:00
Spirv.cpp
Spirv.h
Statistics.cpp VideoCommon/Statistics: Remove global system accessor from s_after_frame_event 2024-01-31 13:12:09 -05:00
Statistics.h Fix uninitialized variable warnings (C26495) 2023-02-15 19:18:39 -08:00
TextureCacheBase.cpp VideoCommon: Scan texture dumping directory + subdirectories to not re-dump existing files. 2024-03-21 20:27:34 -05:00
TextureCacheBase.h VideoCommon: Scan texture dumping directory + subdirectories to not re-dump existing files. 2024-03-21 20:27:34 -05:00
TextureConfig.cpp
TextureConfig.h TextureConfig: Collapse std namespace for hash 2024-01-31 12:41:33 -05:00
TextureConversionShader.cpp Common/MathUtil: Move IntLog2 into MathUtil namespace 2023-04-15 03:35:05 -04:00
TextureConversionShader.h
TextureConverterShaderGen.cpp VideoCommon: apply "force 24-bit color" to EFB-to-VRAM copies as well 2023-12-20 02:25:07 +00:00
TextureConverterShaderGen.h
TextureDecoder_Common.cpp TextureDecoder: Fix warning: array subscript has type ‘char’ [-Wchar-subscripts] 2023-02-09 16:23:02 -08:00
TextureDecoder_Generic.cpp
TextureDecoder_Util.h
TextureDecoder_x64.cpp
TextureDecoder.h
TextureInfo.cpp Common/MathUtil: Move IntLog2 into MathUtil namespace 2023-04-15 03:35:05 -04:00
TextureInfo.h
TextureUtils.cpp VideoCommon: Scan texture dumping directory + subdirectories to not re-dump existing files. 2024-03-21 20:27:34 -05:00
TextureUtils.h VideoCommon: Scan texture dumping directory + subdirectories to not re-dump existing files. 2024-03-21 20:27:34 -05:00
TMEM.cpp
TMEM.h
UberShaderCommon.cpp EnumUtils: Add Common::ToUnderlying 2023-06-17 07:15:33 -05:00
UberShaderCommon.h
UberShaderPixel.cpp VideoCommon: Don't use indexed output for fbfetch 2024-02-07 03:52:31 +01:00
UberShaderPixel.h VideoCommon: uber pixel shader gen changes needed to support custom pixel shaders in graphics mods 2023-08-20 18:53:27 -05:00
UberShaderVertex.cpp VideoCommon: Fix VS point/line on older GLSL 2023-10-24 23:18:01 -05:00
UberShaderVertex.h
VertexLoader_Color.cpp VertexLoader: Fix wrong array being used if color 1 is present but color 0 isn't 2023-12-02 15:54:52 -08:00
VertexLoader_Color.h VertexLoader: Fix wrong array being used if color 1 is present but color 0 isn't 2023-12-02 15:54:52 -08:00
VertexLoader_Normal.cpp Fix out of bounds accesses for invalid vertex component formats 2024-04-04 12:50:34 -07:00
VertexLoader_Normal.h Fix out of bounds accesses for invalid vertex component formats 2024-04-04 12:50:34 -07:00
VertexLoader_Position.cpp Fix out of bounds accesses for invalid vertex component formats 2024-04-04 12:50:34 -07:00
VertexLoader_Position.h Fix out of bounds accesses for invalid vertex component formats 2024-04-04 12:50:34 -07:00
VertexLoader_TextCoord.cpp Fix out of bounds accesses for invalid vertex component formats 2024-04-04 12:50:34 -07:00
VertexLoader_TextCoord.h Fix out of bounds accesses for invalid vertex component formats 2024-04-04 12:50:34 -07:00
VertexLoader.cpp VertexLoader: Use Common::SmallVector 2023-12-02 15:54:52 -08:00
VertexLoader.h VertexLoader: Use Common::SmallVector 2023-12-02 15:54:52 -08:00
VertexLoaderARM64.cpp Fix out of bounds accesses for invalid vertex component formats 2024-04-04 12:50:34 -07:00
VertexLoaderARM64.h VertexLoader: Eliminate use of DataReader 2022-11-22 17:17:11 -08:00
VertexLoaderBase.cpp VertexLoaderBase: Fix shadowing warning 2023-02-09 16:23:02 -08:00
VertexLoaderBase.h VertexLoaderBase: Collapse std namespace for hash and mark noexcept 2024-01-31 12:43:00 -05:00
VertexLoaderManager.cpp Fix out of bounds accesses for invalid vertex component formats 2024-04-04 12:50:34 -07:00
VertexLoaderManager.h VertexLoader: Eliminate use of DataReader 2022-11-22 17:17:11 -08:00
VertexLoaderUtils.h VertexLoader: Eliminate use of DataReader 2022-11-22 17:17:11 -08:00
VertexLoaderX64.cpp Fix out of bounds accesses for invalid vertex component formats 2024-04-04 12:50:34 -07:00
VertexLoaderX64.h VertexLoader: Eliminate use of DataReader 2022-11-22 17:17:11 -08:00
VertexManagerBase.cpp VideoCommon/Statistics: Remove global system accessor from s_after_frame_event 2024-01-31 13:12:09 -05:00
VertexManagerBase.h VertexManagerBase: Initialize m_ticks_elapsed on construction 2024-02-28 10:21:08 -05:00
VertexShaderGen.cpp VideoCommon: Fix VS point/line on older GLSL 2023-10-24 23:18:01 -05:00
VertexShaderGen.h Fix build errors related to formatting non-scoped enums 2022-11-23 13:45:43 -08:00
VertexShaderManager.cpp VideoCommon: move xf state management to its own class, so changes can be detected in places other than VertexShaderManager 2023-11-26 16:27:26 -06:00
VertexShaderManager.h VideoCommon: move xf state management to its own class, so changes can be detected in places other than VertexShaderManager 2023-11-26 16:27:26 -06:00
VideoBackendBase.cpp VideoCommon: Prefer D3D11/12 over OpenGL on Windows. 2024-03-15 19:51:04 -05:00
VideoBackendBase.h VideoCommon: Pass WindowSystemInfo to InitBackendInfo 2023-06-08 22:07:39 -07:00
VideoCommon.h Fix warning about compare sign mismatch 2023-01-31 19:41:23 +13:00
VideoConfig.cpp VideoCommon/Statistics: Remove global system accessor from s_after_frame_event 2024-01-31 13:12:09 -05:00
VideoConfig.h Add custom relative and raw (squared pixels) aspect ratio modes 2024-02-29 21:11:19 +02:00
VideoEvents.h VideoCommon/Statistics: Remove global system accessor from s_after_frame_event 2024-01-31 13:12:09 -05:00
VideoState.cpp VideoCommon: move xf state management to its own class, so changes can be detected in places other than VertexShaderManager 2023-11-26 16:27:26 -06:00
VideoState.h
Widescreen.cpp Video: update widescreen heuristic code to never get stuck to specific old values when changing settings 2024-02-20 22:26:19 +02:00
Widescreen.h Video: update widescreen heuristic code to never get stuck to specific old values when changing settings 2024-02-20 22:26:19 +02:00
XFMemory.cpp
XFMemory.h VideoCommon: Add class for quickly transforming and culling vertices on the CPU 2023-01-25 02:21:56 -06:00
XFStateManager.cpp VideoCommon: move xf state management to its own class, so changes can be detected in places other than VertexShaderManager 2023-11-26 16:27:26 -06:00
XFStateManager.h VideoCommon: move xf state management to its own class, so changes can be detected in places other than VertexShaderManager 2023-11-26 16:27:26 -06:00
XFStructs.cpp VideoCommon: move xf state management to its own class, so changes can be detected in places other than VertexShaderManager 2023-11-26 16:27:26 -06:00
XFStructs.h