From 0969bf350064ca00f54cb0dd83f54688f22897a2 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Sun, 17 Jan 2021 20:39:19 +0100 Subject: [PATCH 1/2] Fix Divide-by-zero in vector3 Fix for https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=29655 --- include/assimp/vector3.inl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/assimp/vector3.inl b/include/assimp/vector3.inl index 2765115a2..fda47d6a7 100644 --- a/include/assimp/vector3.inl +++ b/include/assimp/vector3.inl @@ -154,6 +154,9 @@ const aiVector3t& aiVector3t::operator *= (TReal f) { template AI_FORCE_INLINE const aiVector3t& aiVector3t::operator /= (TReal f) { + if ((T) f==0.0) { + return *this; + } const TReal invF = (TReal) 1.0 / f; x *= invF; y *= invF; From 658fec3e61cdb5c2eed66b1d6d3747b85d97565d Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Sun, 17 Jan 2021 20:41:44 +0100 Subject: [PATCH 2/2] Fix cast --- include/assimp/vector3.inl | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/include/assimp/vector3.inl b/include/assimp/vector3.inl index fda47d6a7..1d024e03f 100644 --- a/include/assimp/vector3.inl +++ b/include/assimp/vector3.inl @@ -5,8 +5,6 @@ Open Asset Import Library (assimp) Copyright (c) 2006-2020, assimp team - - All rights reserved. Redistribution and use of this software in source and binary forms, @@ -154,7 +152,7 @@ const aiVector3t& aiVector3t::operator *= (TReal f) { template AI_FORCE_INLINE const aiVector3t& aiVector3t::operator /= (TReal f) { - if ((T) f==0.0) { + if ( f == static_cast(0.0)) { return *this; } const TReal invF = (TReal) 1.0 / f;