From 9152a8e98ff41fa69c8ae0c81ed99211f12c9436 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 22 Aug 2020 15:32:04 -0400 Subject: [PATCH] avoid division by zero in imaging code --- src/image.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/image.cpp b/src/image.cpp index 315348065a..e264ba3979 100644 --- a/src/image.cpp +++ b/src/image.cpp @@ -651,7 +651,7 @@ void Image::draw_cylinder(double *x, double *y, double c = surface[0] * surface[0] + surface[1] * surface[1] - radsq; double partial = b*b - 4*a*c; - if (partial < 0) continue; + if ((partial < 0.0) || (a == 0.0)) continue; partial = sqrt (partial); double t = (-b + partial) / (2*a);