shithub: tinygl

Download patch

ref: e917e944d5ce94e6498235194e9e4d75a0f0675f
parent: cb5d300d8f8f95475c3e0e123b79e90da2503e97
author: David <gek@katherine>
date: Thu Feb 11 19:55:13 EST 2021

Fixed floating point divide by zero in 3dMath

--- a/src/include/3dMath.h
+++ b/src/include/3dMath.h
@@ -504,7 +504,7 @@
 	float lv3 = lengthv3(diff);
 	float l = (s1.d[3] + s2.d[3]-lv3);
 	
-	if(l < 0) {
+	if(l < 0 || lv3 == 0) {
 		ret.d[3] = 0;return ret;
 	}
 	ret = upv3(