Change the offset variable to an unsigned int since it cannot be negative and is assigned to streamOffset which is an unsigned int.
TRAC #23671
Signed-off-by: Nicolas Capens
Signed-off-by: Shannon Woods
Author: Geoff Lang
diff --git a/src/libGLESv2/renderer/IndexDataManager.cpp b/src/libGLESv2/renderer/IndexDataManager.cpp
index 666f493..3fe05cb 100644
--- a/src/libGLESv2/renderer/IndexDataManager.cpp
+++ b/src/libGLESv2/renderer/IndexDataManager.cpp
@@ -115,13 +115,19 @@
}
GLenum destinationIndexType = (type == GL_UNSIGNED_INT) ? GL_UNSIGNED_INT : GL_UNSIGNED_SHORT;
- intptr_t offset = reinterpret_cast<intptr_t>(indices);
+ unsigned int offset = 0;
bool alignedOffset = false;
BufferStorage *storage = NULL;
if (buffer != NULL)
{
+ if (reinterpret_cast<uintptr_t>(indices) > std::numeric_limits<unsigned int>::max())
+ {
+ return GL_OUT_OF_MEMORY;
+ }
+ offset = static_cast<unsigned int>(reinterpret_cast<uintptr_t>(indices));
+
storage = buffer->getStorage();
switch (type)