浏览代码

Merge pull request #3586 from assimp/kimkulling-ossfuzz_issue29655

Fix Divide-by-zero in vector3
Kim Kulling 4 年之前
父节点
当前提交
3c1d8850a4
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3 2
      include/assimp/vector3.inl

+ 3 - 2
include/assimp/vector3.inl

@@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
 
 
 Copyright (c) 2006-2020, assimp team
 Copyright (c) 2006-2020, assimp team
 
 
-
-
 All rights reserved.
 All rights reserved.
 
 
 Redistribution and use of this software in source and binary forms,
 Redistribution and use of this software in source and binary forms,
@@ -154,6 +152,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 ( f == static_cast<TReal>(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;