Fix Divide-by-zero in vector3

Fix for https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=29655
kimkulling-ossfuzz_issue29655
Kim Kulling 2021-01-17 20:39:19 +01:00 committed by GitHub
parent 061ef1f263
commit 0969bf3500
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -154,6 +154,9 @@ const aiVector3t<TReal>& aiVector3t<TReal>::operator *= (TReal f) {
template <typename TReal> template <typename TReal>
AI_FORCE_INLINE AI_FORCE_INLINE
const aiVector3t<TReal>& aiVector3t<TReal>::operator /= (TReal f) { const aiVector3t<TReal>& aiVector3t<TReal>::operator /= (TReal f) {
if ((T) f==0.0) {
return *this;
}
const TReal invF = (TReal) 1.0 / f; const TReal invF = (TReal) 1.0 / f;
x *= invF; x *= invF;
y *= invF; y *= invF;