From 02fbcfd814d92fc2388fefd98a3bf11088f95b25 Mon Sep 17 00:00:00 2001 From: Arseny Kapoulkine Date: Tue, 21 May 2024 18:24:01 -0700 Subject: [PATCH] gltfpack: Decompress meshopt buffers after cgltf_validate cgltf_validate checks a host of preconditions that make meshopt decoding safe; the only thing we're missing is index validation after meshopt decoding but that does have an assertion, and could also be done separately in the future. --- gltf/parsegltf.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gltf/parsegltf.cpp b/gltf/parsegltf.cpp index f511f2a5..9b22dd43 100644 --- a/gltf/parsegltf.cpp +++ b/gltf/parsegltf.cpp @@ -571,8 +571,8 @@ cgltf_data* parseGltf(const char* path, std::vector& meshes, std::vector& meshes, cgltf_result result = cgltf_parse(&options, buffer, size, &data); result = (result == cgltf_result_success) ? cgltf_load_buffers(&options, data, NULL) : result; - result = (result == cgltf_result_success) ? decompressMeshopt(data) : result; result = (result == cgltf_result_success) ? cgltf_validate(data) : result; + result = (result == cgltf_result_success) ? decompressMeshopt(data) : result; return parseGltf(data, result, meshes, animations, error); }