Add guards against malformed images. (#114)

This commit is contained in:
Branimir Karadžić
2026-04-23 13:47:52 -07:00
committed by GitHub
parent 18d3d64042
commit 6fa3a8b209

View File

@@ -745,6 +745,14 @@ namespace bimg
return NULL;
}
if (0 == width
|| 0 == height)
{
stbi_image_free(data);
BX_ERROR_SET(_err, BIMG_ERROR, "stb_image: Invalid image dimensions.");
return NULL;
}
bimg::TextureFormat::Enum format = bimg::TextureFormat::RGBA8;
if (isHdr)