Fix OOB write in PGRAPH_CONTEXT_CACHE

This commit is contained in:
starfrost013
2025-04-21 13:50:06 +01:00
parent 01f7d3f88e
commit 1e5bdfbd16
2 changed files with 3 additions and 2 deletions

View File

@@ -36,7 +36,8 @@
"name": "debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"NV_LOG": "ON"
"NV_LOG": "ON",
"NV_LOG_ULTRA": "ON"
},
"inherits": "base"
},

View File

@@ -478,7 +478,7 @@ void nv3_pgraph_write(uint32_t address, uint32_t value)
&& address <= NV3_PGRAPH_CONTEXT_CACHE(NV3_PGRAPH_CONTEXT_CACHE_SIZE))
{
// Addresses should be aligned to 4 bytes.
uint32_t entry = (address - NV3_PGRAPH_CONTEXT_CACHE(0));
uint32_t entry = (address - NV3_PGRAPH_CONTEXT_CACHE(0)) >> 2;
nv_log_verbose_only("PGRAPH Context Cache Write (Entry=%04x Value=0x%08x)\n", entry, value);
nv3->pgraph.context_cache[entry] = value;