VertexArrayGL: fix an off by one error for indexRange for drawElements
DrawElements' range was of the form [start, end] while DrawArrays' was
of the form [start, end), which caused an out of bound array access in
the client vertex pointers.
This issue was detected while running angle_end2end_tests with
AddressSanitizer.
BUG=angleproject:1137
Change-Id: Id9abddf29eaf73bacfd08d1616a999be2fe616b8
Reviewed-on: https://chromium-review.googlesource.com/295122
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/libANGLE/renderer/gl/VertexArrayGL.cpp b/src/libANGLE/renderer/gl/VertexArrayGL.cpp
index 3da883e..e43cb7a 100644
--- a/src/libANGLE/renderer/gl/VertexArrayGL.cpp
+++ b/src/libANGLE/renderer/gl/VertexArrayGL.cpp
@@ -116,9 +116,9 @@
}
else
{
- // Not an indexed call, set the range to [first, first + count)
+ // Not an indexed call, set the range to [first, first + count - 1]
indexRange.start = first;
- indexRange.end = first + count;
+ indexRange.end = first + count - 1;
}
if (attributesNeedStreaming)