From 0dbf2b40f6f30728858fadb6390c465dc36669aa Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 28 May 2025 20:54:03 +0300 Subject: #4080 Fix gltf crash when opening --- indra/newview/gltf/buffer_util.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/newview/gltf/buffer_util.h') diff --git a/indra/newview/gltf/buffer_util.h b/indra/newview/gltf/buffer_util.h index ef9bba8128..2632a0f263 100644 --- a/indra/newview/gltf/buffer_util.h +++ b/indra/newview/gltf/buffer_util.h @@ -158,6 +158,12 @@ namespace LL dst.load3(src); } + template<> + inline void copyVec3(F32* src, LLColor4U& dst) + { + dst.set((U8)(src[0] * 255.f), (U8)(src[1] * 255.f), (U8)(src[2] * 255.f), 255); + } + template<> inline void copyVec3(U16* src, LLColor4U& dst) { -- cgit v1.2.3 From bd7e79df36f8bf473bd6332eda7f1def5b9aaad7 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 30 May 2025 17:37:51 +0300 Subject: #4191 Crash opening a gltf model --- indra/newview/gltf/buffer_util.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra/newview/gltf/buffer_util.h') diff --git a/indra/newview/gltf/buffer_util.h b/indra/newview/gltf/buffer_util.h index 2632a0f263..be36c5e90b 100644 --- a/indra/newview/gltf/buffer_util.h +++ b/indra/newview/gltf/buffer_util.h @@ -375,6 +375,11 @@ namespace LL template inline void copy(Asset& asset, Accessor& accessor, LLStrider& dst) { + if (accessor.mBufferView == INVALID_INDEX) + { + LL_WARNS("GLTF") << "Invalid buffer" << LL_ENDL; + return; + } const BufferView& bufferView = asset.mBufferViews[accessor.mBufferView]; const Buffer& buffer = asset.mBuffers[bufferView.mBuffer]; const U8* src = buffer.mData.data() + bufferView.mByteOffset + accessor.mByteOffset; -- cgit v1.2.3