citra-emu
/
citra
Archived
1
0
Fork 0

GetTextureSurface: return on invalid physical address early

Previously this check is in GetSurface (if (addr == 0)). This worked fine because GetTextureSurface directly forwarded the address value to GetSurface. However, now with mipmap support, GetTextureSurface would call GetSurface several times with different address offset, resulting some >0 but still invalid address in case the input is 0. We should error out early on invalid address instead of sending it furthor down which would cause invalid memory access
This commit is contained in:
Weiyi Wang 2019-03-10 11:02:56 -04:00
parent ebdef4fd69
commit 88a011ec8e
1 changed files with 4 additions and 0 deletions

View File

@ -1332,6 +1332,10 @@ Surface RasterizerCacheOpenGL::GetTextureSurface(
Surface RasterizerCacheOpenGL::GetTextureSurface(const Pica::Texture::TextureInfo& info,
u32 max_level) {
if (info.physical_address == 0) {
return nullptr;
}
SurfaceParams params;
params.addr = info.physical_address;
params.width = info.width;