Handle images with invalid resolution
This commit is contained in:
@@ -94,6 +94,14 @@ namespace OpenVulkano
|
||||
void Read(std::istream& inStream)
|
||||
{
|
||||
inStream >> header;
|
||||
|
||||
if (header.width == UINT32_MAX || header.height == UINT32_MAX)
|
||||
{
|
||||
header.width = header.height = 0;
|
||||
image = nullptr;
|
||||
return;
|
||||
}
|
||||
|
||||
size_t size = header.GetElementCount();
|
||||
|
||||
image = std::make_unique<float[]>(size);
|
||||
|
||||
@@ -139,6 +139,13 @@ namespace OpenVulkano
|
||||
// TODO handle ascii mode
|
||||
if (header.ascii) throw std::runtime_error("ascii mode not supported!");
|
||||
|
||||
if (header.width == UINT32_MAX || header.height == UINT32_MAX)
|
||||
{
|
||||
header.width = header.height = 0;
|
||||
image = nullptr;
|
||||
return;
|
||||
}
|
||||
|
||||
size_t size = header.GetImageSize();
|
||||
image = std::make_unique<char[]>(size);
|
||||
inStream.read(image.get(), size);
|
||||
|
||||
Reference in New Issue
Block a user