mirror of https://github.com/bjornbytes/lovr.git
Error in setVertices when overflowing Mesh size;
This commit is contained in:
parent
7077d89a22
commit
2ae10967c4
|
@ -213,6 +213,11 @@ int l_lovrMeshSetVertices(lua_State* L) {
|
||||||
luaL_checktype(L, 2, LUA_TTABLE);
|
luaL_checktype(L, 2, LUA_TTABLE);
|
||||||
int vertexCount = lua_objlen(L, 2);
|
int vertexCount = lua_objlen(L, 2);
|
||||||
int start = luaL_optnumber(L, 3, 1) - 1;
|
int start = luaL_optnumber(L, 3, 1) - 1;
|
||||||
|
int maxVertices = lovrMeshGetVertexCount(mesh);
|
||||||
|
|
||||||
|
if (start + vertexCount > maxVertices) {
|
||||||
|
return luaL_error(L, "Mesh can only hold %d vertices", maxVertices);
|
||||||
|
}
|
||||||
|
|
||||||
void* vertices = lovrMeshMap(mesh, start, vertexCount);
|
void* vertices = lovrMeshMap(mesh, start, vertexCount);
|
||||||
char* vertex = vertices;
|
char* vertex = vertices;
|
||||||
|
|
Loading…
Reference in New Issue