Commit 2c34a4b0 by Corentin Wallez

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/295122Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Tested-by: 's avatarCorentin Wallez <cwallez@chromium.org>
parent 83f3411d
...@@ -503,7 +503,6 @@ inline unsigned int averageFloat10(unsigned int a, unsigned int b) ...@@ -503,7 +503,6 @@ inline unsigned int averageFloat10(unsigned int a, unsigned int b)
return float32ToFloat10((float10ToFloat32(static_cast<unsigned short>(a)) + float10ToFloat32(static_cast<unsigned short>(b))) * 0.5f); return float32ToFloat10((float10ToFloat32(static_cast<unsigned short>(a)) + float10ToFloat32(static_cast<unsigned short>(b))) * 0.5f);
} }
// Represents intervals of the type [a, b)
template <typename T> template <typename T>
struct Range struct Range
{ {
......
...@@ -116,9 +116,9 @@ gl::Error VertexArrayGL::syncDrawState(const gl::AttributesMask &activeAttribute ...@@ -116,9 +116,9 @@ gl::Error VertexArrayGL::syncDrawState(const gl::AttributesMask &activeAttribute
} }
else 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.start = first;
indexRange.end = first + count; indexRange.end = first + count - 1;
} }
if (attributesNeedStreaming) if (attributesNeedStreaming)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment