mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-07-11 01:25:07 +02:00
Avoid calling IsValidRange with zero length
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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.)
|
||||
|
||||
Reference in New Issue
Block a user