summaryrefslogtreecommitdiff
path: root/indra/llmath/llvector4a.h
diff options
context:
space:
mode:
authorRye <rye@lindenlab.com>2025-01-23 18:40:19 -0500
committerRye <rye@lindenlab.com>2025-01-23 18:40:19 -0500
commit4763195e186f8c56c2ee92d4e0154c95aa011997 (patch)
treedc1f37243597961c9389746fb0a12bb8c8e5d71c /indra/llmath/llvector4a.h
parent4ff56cfac8e3aaf1459c656306e2c18e7f63eaeb (diff)
Fix potential undefined behavior when converting to and from glm types from LLVector3/4 and fall back mul_mat4_vec3 to scalar implementation to attempt crash mitigation (#3339)
Diffstat (limited to 'indra/llmath/llvector4a.h')
-rw-r--r--indra/llmath/llvector4a.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/indra/llmath/llvector4a.h b/indra/llmath/llvector4a.h
index 8ef560dadf..4004852e06 100644
--- a/indra/llmath/llvector4a.h
+++ b/indra/llmath/llvector4a.h
@@ -33,6 +33,9 @@ class LLRotation;
#include <assert.h>
#include "llpreprocessor.h"
#include "llmemory.h"
+#include "glm/vec3.hpp"
+#include "glm/vec4.hpp"
+#include "glm/gtc/type_ptr.hpp"
///////////////////////////////////
// FIRST TIME USERS PLEASE READ
@@ -364,6 +367,16 @@ public:
inline operator LLQuad() const;
+ explicit inline operator glm::vec3() const
+ {
+ return glm::make_vec3(getF32ptr());
+ };
+
+ explicit inline operator glm::vec4() const
+ {
+ return glm::make_vec4(getF32ptr());
+ };
+
private:
LLQuad mQ{};
};