diff --git a/Core/Util/PPGeDraw.cpp b/Core/Util/PPGeDraw.cpp index 9d7879cdb6..8effbb102f 100644 --- a/Core/Util/PPGeDraw.cpp +++ b/Core/Util/PPGeDraw.cpp @@ -1418,10 +1418,11 @@ bool PPGeImage::IsValid() { if (loadFailed_) return false; - if (!Memory::IsValidRange(this->png_, (u32)this->size_)) { + if (size_ && !Memory::IsValidRange(this->png_, (u32)this->size_)) { return false; } + // TODO: It's really wacky to call Decimate from in here. if (texture_ == 0) { Decimate(); return Load(); diff --git a/GPU/Common/TextureCacheCommon.cpp b/GPU/Common/TextureCacheCommon.cpp index 027977fb0e..c1d8e067a4 100644 --- a/GPU/Common/TextureCacheCommon.cpp +++ b/GPU/Common/TextureCacheCommon.cpp @@ -1683,7 +1683,7 @@ static CheckAlphaResult DecodeDXTBlocks(uint8_t *out, int outPitch, uint32_t tex int outPitch32 = outPitch / sizeof(uint32_t); const DXTBlock *src = (const DXTBlock *)texptr; - if (!Memory::IsValidRange(texaddr, (h / 4) * (bufw / 4) * sizeof(DXTBlock))) { + if (!Memory::IsValidRange(texaddr, ((h + 3) / 4) * (bufw / 4) * sizeof(DXTBlock))) { ERROR_LOG_REPORT(Log::G3D, "DXT%d texture extends beyond valid RAM: %08x + %d x %d", n, texaddr, bufw, h); uint32_t limited = Memory::ValidSize(texaddr, (h / 4) * (bufw / 4) * sizeof(DXTBlock)); // This might possibly be 0, but try to decode what we can (might even be how the PSP behaves.)