Procházet zdrojové kódy

GLTF: fix segfault in animNormals memcpy when mesh.normals == NULL (#3103)

pull/3106/head
Charles před 2 roky
odevzdal GitHub
rodič
revize
2e00d16f3d
V databázi nebyl nalezen žádný známý klíč pro tento podpis ID GPG klíče: 4AEE18F83AFDEB23
1 změnil soubory, kde provedl 3 přidání a 1 odebrání
  1. +3
    -1
      src/rmodels.c

+ 3
- 1
src/rmodels.c Zobrazit soubor

@ -5201,7 +5201,9 @@ static Model LoadGLTF(const char *fileName)
model.meshes[meshIndex].animVertices = RL_CALLOC(model.meshes[meshIndex].vertexCount*3, sizeof(float));
memcpy(model.meshes[meshIndex].animVertices, model.meshes[meshIndex].vertices, model.meshes[meshIndex].vertexCount*3*sizeof(float));
model.meshes[meshIndex].animNormals = RL_CALLOC(model.meshes[meshIndex].vertexCount*3, sizeof(float));
memcpy(model.meshes[meshIndex].animNormals, model.meshes[meshIndex].normals, model.meshes[meshIndex].vertexCount*3*sizeof(float));
if (model.meshes[meshIndex].normals != NULL) {
memcpy(model.meshes[meshIndex].animNormals, model.meshes[meshIndex].normals, model.meshes[meshIndex].vertexCount*3*sizeof(float));
}
meshIndex++; // Move to next mesh
}

Načítá se…
Zrušit
Uložit