Fix a crash when loading .pvr compressed texture.

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2017-04-01 21:20:08 -03:00
parent f8c58c54c8
commit 60f898af67
2 changed files with 2 additions and 3 deletions
+1 -1
View File
@@ -101,7 +101,7 @@ static T *loadEXRChannels(int width, int height, T *rgba[4], T one)
FormatHandler::DecodedImage EXRHandler::decode(love::filesystem::FileData *data)
{
const char *err;
const char *err = "unknown error";
auto mem = (const unsigned char *) data->getData();
size_t memsize = data->getSize();
DecodedImage img;
+1 -2
View File
@@ -513,7 +513,6 @@ StrongRef<CompressedImageData::Memory> PVRHandler::parse(filesystem::FileData *f
throw love::Exception("Could not parse PVR file: unsupported image format.");
size_t totalsize = 0;
uint8 *data = nullptr;
// Ignore faces and surfaces except the first ones (for now.)
for (int i = 0; i < (int) header3.numMipmaps; i++)
@@ -541,7 +540,7 @@ StrongRef<CompressedImageData::Memory> PVRHandler::parse(filesystem::FileData *f
int width = std::max((int) header3.width >> i, 1);
int height = std::max((int) header3.height >> i, 1);
memcpy(data + curoffset, filebytes + curoffset, mipsize);
memcpy(memory->data + curoffset, filebytes + curoffset, mipsize);
auto slice = new CompressedImageData::Slice(cformat, width, height, memory, curoffset, mipsize);
images.push_back(slice);