Skip to content

Commit 0932ba6

Browse files
committed
Added guard for 32-bit overflow in spritefont reading
1 parent 4652d66 commit 0932ba6

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

Src/BinaryReader.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,7 @@ namespace DirectX
4545
{
4646
static_assert(std::is_standard_layout<T>::value, "Can only read plain-old-data types");
4747

48-
uint64_t byteCount = uint64_t(sizeof(T)) * uint64_t(elementCount);
49-
if (byteCount > UINT32_MAX)
50-
throw std::overflow_error("ReadArray");
51-
52-
uint8_t const* newPos = mPos + static_cast<size_t>(byteCount);
48+
uint8_t const* newPos = mPos + sizeof(T) * elementCount;
5349

5450
if (newPos < mPos)
5551
throw std::overflow_error("ReadArray");

0 commit comments

Comments
 (0)