summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPierre Joye <pierre.php@gmail.com>2021-08-26 22:40:15 +0700
committerPierre Joye <pierre.php@gmail.com>2021-08-26 22:40:15 +0700
commit13d3b67822f9e8b2f6cfc96933abeef054d37085 (patch)
treeec7383b9e604691603727ea5b786dfb2bbba9d58 /src
parent63070b49e2f7380b11bf8d2f6f8cdf49cbe8076d (diff)
downloadlibgd-13d3b67822f9e8b2f6cfc96933abeef054d37085.tar.gz
Fix #402, negative determinant fails, only 0 or not finite should fail
Diffstat (limited to 'src')
-rw-r--r--src/gd_matrix.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/gd_matrix.c b/src/gd_matrix.c
index def3f3c..7ee2e6f 100644
--- a/src/gd_matrix.c
+++ b/src/gd_matrix.c
@@ -84,7 +84,10 @@ BGD_DECLARE(int) gdAffineInvert (double dst[6], const double src[6])
{
double r_det = (src[0] * src[3] - src[1] * src[2]);
- if (fabs(r_det) <= 0.0) {
+ if (!isfinite(r_det)) {
+ return GD_FALSE;
+ }
+ if (r_det == 0) {
return GD_FALSE;
}