From 85bdd452d7090f78a0f76d02121fa59ad079b7f6 Mon Sep 17 00:00:00 2001 From: Sergey Lipskiy Date: Sat, 1 Jun 2024 18:05:38 +0700 Subject: [PATCH] Do not load texture if tile width or height is negative. See #2839 for details. --- src/Textures.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Textures.cpp b/src/Textures.cpp index 4d4c91a9b..7772717f3 100644 --- a/src/Textures.cpp +++ b/src/Textures.cpp @@ -2091,6 +2091,12 @@ void TextureCache::update(u32 _t) pTile = gSP.textureTile[_t]; } + // Sanity check + if ((int)pTile->lrs - (int)pTile->uls < 0 || (int)pTile->lrt - (int)pTile->ult < 0) { + activateDummy(_t); + return; + } + TileSizes sizes; _calcTileSizes(_t, sizes, gDP.loadTile); TextureParams params;