We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 624f4d0 commit 4652d66Copy full SHA for 4652d66
1 file changed
Src/BinaryReader.h
@@ -45,7 +45,11 @@ namespace DirectX
45
{
46
static_assert(std::is_standard_layout<T>::value, "Can only read plain-old-data types");
47
48
- uint8_t const* newPos = mPos + sizeof(T) * elementCount;
+ 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);
53
54
if (newPos < mPos)
55
throw std::overflow_error("ReadArray");
0 commit comments