diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2018-05-04 01:31:43 +0200 |
---|---|---|
committer | Lauren Budorick <lauren@mapbox.com> | 2018-05-03 16:31:43 -0700 |
commit | c3346f473ac7e3d49219c8dbc381d92f8fe3f017 (patch) | |
tree | 7e7d1c1569c849192209b0c5f5a58ef7736896a1 /src/mbgl/gl/vertex_array.cpp | |
parent | f6da3ba9be27ff9b279730603c517c4cb5e57007 (diff) | |
download | qtlocation-mapboxgl-c3346f473ac7e3d49219c8dbc381d92f8fe3f017.tar.gz |
[core] Don't crash when attribute count is exceeded
Diffstat (limited to 'src/mbgl/gl/vertex_array.cpp')
-rw-r--r-- | src/mbgl/gl/vertex_array.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/mbgl/gl/vertex_array.cpp b/src/mbgl/gl/vertex_array.cpp index 68a500ac45..d552a8292e 100644 --- a/src/mbgl/gl/vertex_array.cpp +++ b/src/mbgl/gl/vertex_array.cpp @@ -9,7 +9,11 @@ void VertexArray::bind(Context& context, BufferID indexBuffer, const AttributeBi context.bindVertexArray = state->vertexArray; state->indexBuffer = indexBuffer; - for (AttributeLocation location = 0; location < MAX_ATTRIBUTES; ++location) { + state->bindings.reserve(bindings.size()); + for (AttributeLocation location = 0; location < bindings.size(); ++location) { + if (state->bindings.size() <= location) { + state->bindings.emplace_back(context, AttributeLocation(location)); + } state->bindings[location] = bindings[location]; } } |