瀏覽代碼

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

pull/3106/head
Charles 1 年之前
committed by GitHub
父節點
當前提交
2e00d16f3d
沒有發現已知的金鑰在資料庫的簽署中 GPG 金鑰 ID: 4AEE18F83AFDEB23
共有 1 個檔案被更改,包括 3 行新增1 行删除
  1. +3
    -1
      src/rmodels.c

+ 3
- 1
src/rmodels.c 查看文件

@ -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
}

Loading…
取消
儲存