We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c037a02 commit 9b498b4Copy full SHA for 9b498b4
1 file changed
Src/SpriteFont.cpp
@@ -156,6 +156,18 @@ SpriteFont::Impl::Impl(
156
auto textureStride = reader->Read<uint32_t>();
157
auto textureRows = reader->Read<uint32_t>();
158
159
+ if (!textureWidth
160
+ || !textureHeight
161
+ || !textureStride
162
+ || !textureRows
163
+ || (textureWidth > D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION)
164
+ || (textureHeight > D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION)
165
+ || LoaderHelpers::BitsPerPixel(textureFormat) == 0)
166
+ {
167
+ DebugTrace("ERROR: SpriteFont provided with an invalid .spritefont file\n");
168
+ throw std::runtime_error("Invalid .spritefont file");
169
+ }
170
+
171
const uint64_t dataSize = uint64_t(textureStride) * uint64_t(textureRows);
172
if (dataSize > UINT32_MAX)
173
{
0 commit comments