Extract validation from VertexDataManager.cpp to the API.
We can check for buffer overflow at draw validation time, before
processing any vertex data.
BUG=angle:571
Change-Id: I4f49629b98c17ca28e25baed74cad4ae5341b20f
Reviewed-on: https://chromium-review.googlesource.com/210647
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Shannon Woods <shannonwoods@chromium.org>
diff --git a/src/libGLESv2/libGLESv2.cpp b/src/libGLESv2/libGLESv2.cpp
index 345d820..103d4ff 100644
--- a/src/libGLESv2/libGLESv2.cpp
+++ b/src/libGLESv2/libGLESv2.cpp
@@ -1294,7 +1294,7 @@
if (context)
{
- if (!ValidateDrawArrays(context, mode, first, count))
+ if (!ValidateDrawArrays(context, mode, first, count, 0))
{
return;
}
@@ -1329,12 +1329,13 @@
if (context)
{
- if (!ValidateDrawElements(context, mode, count, type, indices))
+ rx::RangeUI indexRange;
+ if (!ValidateDrawElements(context, mode, count, type, indices, 0, &indexRange))
{
return;
}
- context->drawElements(mode, count, type, indices, 0);
+ context->drawElements(mode, count, type, indices, 0, indexRange);
}
}
@@ -1347,12 +1348,13 @@
if (context)
{
- if (!ValidateDrawElementsInstanced(context, mode, count, type, indices, primcount))
+ rx::RangeUI indexRange;
+ if (!ValidateDrawElementsInstanced(context, mode, count, type, indices, primcount, &indexRange))
{
return;
}
- context->drawElements(mode, count, type, indices, primcount);
+ context->drawElements(mode, count, type, indices, primcount, indexRange);
}
}