mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-19 19:33:47 +00:00
FIX:Add array out of bounds protection
jira: none Change-Id: I038e45be00664ab35dfbc2d59ddfa6c018cd2873 (cherry picked from commit d4967c8c269d0f9b918e9049addcd7d6f6fd2656)
This commit is contained in:
@@ -3467,17 +3467,20 @@ m_no_render_path = false;
|
|||||||
offset += static_cast<unsigned int>(sub_path.first.i_id);
|
offset += static_cast<unsigned int>(sub_path.first.i_id);
|
||||||
|
|
||||||
// gets the vertex index from the index buffer on gpu
|
// gets the vertex index from the index buffer on gpu
|
||||||
const IBuffer& i_buffer = buffer.indices[sub_path.first.b_id];
|
if (sub_path.first.b_id >= 0 && sub_path.first.b_id < buffer.indices.size()) {
|
||||||
unsigned int index = 0;
|
const IBuffer &i_buffer = buffer.indices[sub_path.first.b_id];
|
||||||
glsafe(::glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, i_buffer.ibo));
|
unsigned int index = 0;
|
||||||
glsafe(::glGetBufferSubData(GL_ELEMENT_ARRAY_BUFFER, static_cast<GLintptr>(offset * sizeof(IBufferType)), static_cast<GLsizeiptr>(sizeof(IBufferType)), static_cast<void*>(&index)));
|
glsafe(::glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, i_buffer.ibo));
|
||||||
glsafe(::glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0));
|
glsafe(::glGetBufferSubData(GL_ELEMENT_ARRAY_BUFFER, static_cast<GLintptr>(offset * sizeof(IBufferType)),
|
||||||
|
static_cast<GLsizeiptr>(sizeof(IBufferType)), static_cast<void *>(&index)));
|
||||||
// gets the position from the vertices buffer on gpu
|
glsafe(::glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0));
|
||||||
glsafe(::glBindBuffer(GL_ARRAY_BUFFER, i_buffer.vbo));
|
|
||||||
glsafe(::glGetBufferSubData(GL_ARRAY_BUFFER, static_cast<GLintptr>(index * buffer.vertices.vertex_size_bytes()), static_cast<GLsizeiptr>(3 * sizeof(float)), static_cast<void*>(sequential_view->current_position.data())));
|
|
||||||
glsafe(::glBindBuffer(GL_ARRAY_BUFFER, 0));
|
|
||||||
|
|
||||||
|
// gets the position from the vertices buffer on gpu
|
||||||
|
glsafe(::glBindBuffer(GL_ARRAY_BUFFER, i_buffer.vbo));
|
||||||
|
glsafe(::glGetBufferSubData(GL_ARRAY_BUFFER, static_cast<GLintptr>(index * buffer.vertices.vertex_size_bytes()),
|
||||||
|
static_cast<GLsizeiptr>(3 * sizeof(float)), static_cast<void *>(sequential_view->current_position.data())));
|
||||||
|
glsafe(::glBindBuffer(GL_ARRAY_BUFFER, 0));
|
||||||
|
}
|
||||||
sequential_view->current_offset = Vec3f::Zero();
|
sequential_view->current_offset = Vec3f::Zero();
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user