Fix KTX1 cube/array loading;

This commit is contained in:
bjorn 2022-08-23 20:17:19 -07:00
parent 0496b81f23
commit d3c93634ad
1 changed files with 4 additions and 3 deletions

View File

@ -1035,12 +1035,13 @@ static Image* loadKTX1(Blob* blob) {
length -= 4;
data += 4;
lovrAssert(length >= size, "KTX file overflow");
size_t totalSize = size * image->layers;
lovrAssert(length >= totalSize, "KTX file overflow");
image->mipmaps[i] = (Mipmap) { data, size, size };
width = MAX(width >> 1, 1);
height = MAX(height >> 1, 1);
length -= size;
data += size;
length -= totalSize;
data += totalSize;
}
return image;