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
AbstractFramebuffer.h
AbstractGfx.cpp
AbstractGfx.h
AbstractPipeline.h
AbstractShader.h
AbstractStagingTexture.cpp
AbstractStagingTexture.h
AbstractTexture.cpp
AbstractTexture.h
AsyncRequests.cpp
AsyncRequests.h
AsyncShaderCompiler.cpp
AsyncShaderCompiler.h
BoundingBox.cpp
BoundingBox.h
BPFunctions.cpp
BPFunctions.h
BPMemory.cpp
BPMemory.h
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
Constants.h
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
CPUCull.h
CPUCullImpl.h
DataReader.h
DriverDetails.cpp
DriverDetails.h
Fifo.cpp
Fifo.h
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
FramebufferShaderGen.h
FrameDumper.cpp VideoCommon/Statistics: Remove global system accessor from s_after_frame_event 2024-01-31 13:12:09 -05:00
FrameDumper.h
FrameDumpFFMpeg.cpp
FrameDumpFFMpeg.h
FreeLookCamera.cpp
FreeLookCamera.h
GeometryShaderGen.cpp
GeometryShaderGen.h
GeometryShaderManager.cpp
GeometryShaderManager.h
GXPipelineTypes.h
HiresTextures.cpp
HiresTextures.h
IndexGenerator.cpp
IndexGenerator.h
LightingShaderGen.cpp
LightingShaderGen.h
LookUpTables.h
NativeVertexFormat.h NativeVertexFormat: Collapse std namespace and mark hash noexcept 2024-01-31 12:37:44 -05:00
NetPlayChatUI.cpp
NetPlayChatUI.h
NetPlayGolfUI.cpp
NetPlayGolfUI.h
OnScreenDisplay.cpp
OnScreenDisplay.h
OnScreenUI.cpp
OnScreenUI.h
OnScreenUIKeyMap.h
OpcodeDecoding.cpp
OpcodeDecoding.h
PerformanceMetrics.cpp
PerformanceMetrics.h
PerformanceTracker.cpp
PerformanceTracker.h
PerfQueryBase.cpp
PerfQueryBase.h
PixelEngine.cpp
PixelEngine.h
PixelShaderGen.cpp VideoCommon: Don't use indexed output for fbfetch 2024-02-07 03:52:31 +01:00
PixelShaderGen.h
PixelShaderManager.cpp
PixelShaderManager.h
PostProcessing.cpp PostProcessing: Don't potentially leak memory in BlitFromTexture() 2024-01-23 13:34:40 -05:00
PostProcessing.h
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
RenderBase.h
RenderState.cpp
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
ShaderGenCommon.cpp
ShaderGenCommon.h
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
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
TextureConversionShader.h
TextureConverterShaderGen.cpp
TextureConverterShaderGen.h
TextureDecoder_Common.cpp
TextureDecoder_Generic.cpp
TextureDecoder_Util.h
TextureDecoder_x64.cpp
TextureDecoder.h
TextureInfo.cpp
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
UberShaderCommon.h
UberShaderPixel.cpp VideoCommon: Don't use indexed output for fbfetch 2024-02-07 03:52:31 +01:00
UberShaderPixel.h
UberShaderVertex.cpp
UberShaderVertex.h
VertexLoader_Color.cpp
VertexLoader_Color.h
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.h
VertexLoaderARM64.cpp Fix out of bounds accesses for invalid vertex component formats 2024-04-04 12:50:34 -07:00
VertexLoaderARM64.h
VertexLoaderBase.cpp
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
VertexLoaderUtils.h
VertexLoaderX64.cpp Fix out of bounds accesses for invalid vertex component formats 2024-04-04 12:50:34 -07:00
VertexLoaderX64.h
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
VertexShaderGen.h
VertexShaderManager.cpp
VertexShaderManager.h
VideoBackendBase.cpp VideoCommon: Prefer D3D11/12 over OpenGL on Windows. 2024-03-15 19:51:04 -05:00
VideoBackendBase.h
VideoCommon.h
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
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
XFStateManager.cpp
XFStateManager.h
XFStructs.cpp
XFStructs.h