diff --git a/Common/Data/Format/PNGLoad.h b/Common/Data/Format/PNGLoad.h index 282fed9d44..76ab04ee9e 100644 --- a/Common/Data/Format/PNGLoad.h +++ b/Common/Data/Format/PNGLoad.h @@ -15,6 +15,8 @@ int pngLoadPtr(const unsigned char *input_ptr, size_t input_len, int *pwidth, // PNG peeker - just read the start of a PNG straight into this struct, in order to // look at basic parameters like width and height. Note that while PNG is a chunk-based // format, the IHDR chunk is REQUIRED to be the first one, so this will work. +// Does not handle Apple's weirdo extension CgBI. http://iphonedevwiki.net/index.php/CgBI_file_format +// That should not be an issue. struct PNGHeaderPeek { uint32_t magic; uint32_t ignore0; diff --git a/Core/TextureReplacer.cpp b/Core/TextureReplacer.cpp index d30da0beed..875ded80fe 100644 --- a/Core/TextureReplacer.cpp +++ b/Core/TextureReplacer.cpp @@ -648,12 +648,13 @@ bool TextureReplacer::PopulateLevelFromZip(ReplacedTextureLevel &level, bool ign } else if (imageType == ReplacedImageType::PNG) { PNGHeaderPeek headerPeek; good = zip_fread(zf, &headerPeek, sizeof(headerPeek)) == sizeof(headerPeek); - if (headerPeek.IsValidPNGHeader()) { + if (good && headerPeek.IsValidPNGHeader()) { level.w = headerPeek.Width(); level.h = headerPeek.Height(); good = true; } else { ERROR_LOG(G3D, "Could not get PNG dimensions: %s (zip)", level.file.ToVisualString().c_str()); + good = false; } } else { ERROR_LOG(G3D, "Could not load texture replacement info: %s - unsupported format (zip)", level.file.ToVisualString().c_str());