We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ef1bd5d commit 6bfda20Copy full SHA for 6bfda20
1 file changed
Src/SpriteFont.cpp
@@ -142,6 +142,18 @@ SpriteFont::Impl::Impl(
142
auto textureStride = reader->Read<uint32_t>();
143
auto textureRows = reader->Read<uint32_t>();
144
145
+ if (!textureWidth
146
+ || !textureHeight
147
+ || !textureStride
148
+ || !textureRows
149
+ || (textureWidth > D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION)
150
+ || (textureHeight > D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION)
151
+ || LoaderHelpers::BitsPerPixel(textureFormat) == 0)
152
+ {
153
+ DebugTrace("ERROR: SpriteFont provided with an invalid .spritefont file\n");
154
+ throw std::runtime_error("Invalid .spritefont file");
155
+ }
156
+
157
const uint64_t dataSize = uint64_t(textureStride) * uint64_t(textureRows);
158
if (dataSize > UINT32_MAX)
159
{
0 commit comments