mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-11-11 12:45:05 +01:00
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:
parent
ebdef4fd69
commit
88a011ec8e
@ -1332,6 +1332,10 @@ Surface RasterizerCacheOpenGL::GetTextureSurface(
|
|||||||
|
|
||||||
Surface RasterizerCacheOpenGL::GetTextureSurface(const Pica::Texture::TextureInfo& info,
|
Surface RasterizerCacheOpenGL::GetTextureSurface(const Pica::Texture::TextureInfo& info,
|
||||||
u32 max_level) {
|
u32 max_level) {
|
||||||
|
if (info.physical_address == 0) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
SurfaceParams params;
|
SurfaceParams params;
|
||||||
params.addr = info.physical_address;
|
params.addr = info.physical_address;
|
||||||
params.width = info.width;
|
params.width = info.width;
|
||||||
|
Loading…
Reference in New Issue
Block a user