]> OCCT Git - occt.git/commitdiff
0033304: Modeling Data - Floating point signal when converting a B-spline curve to...
authormsv <msv@opencascade.com>
Tue, 27 Dec 2022 19:19:11 +0000 (22:19 +0300)
committerVadim Glukhikh <vadim.glukhikh@opencascade.com>
Tue, 3 Jan 2023 18:00:55 +0000 (18:00 +0000)
Protect the static function ConicDefinition from calling sqrt with negative argument.

src/GeomConvert/GeomConvert_CurveToAnaCurve.cxx
tests/bugs/moddata_3/bug33304 [new file with mode: 0644]

index 8e135e1edb2bfb76d7e2068da62ff3a6fc5568a1..3038e88dfa7f1c38f0f0ce0ae3cce640fc2a5f3c 100644 (file)
@@ -429,6 +429,8 @@ static Standard_Boolean ConicDefinition
     term2 = -gdet/(cprim*pdet);
       
     if (IsEllip) {
+      if (term1 <= eps || term2 <= eps)
+        return Standard_False;
       Xax = cost;
       Yax = sint;
       Rmin = sqrt ( term1);
@@ -439,12 +441,16 @@ static Standard_Boolean ConicDefinition
       }
     }
     else if (term1 <= eps){
+      if (-term1 <= eps || term2 <= eps)
+        return Standard_False;
       Xax  = -sint;
       Yax  =  cost;
       Rmin = sqrt (-term1);
       Rmax = sqrt (term2);
     } 
     else {
+      if (term1 <= eps || -term2 <= eps)
+        return Standard_False;
       Xax  =  cost;
       Yax  =  sint;
       Rmin = sqrt (-term2);
diff --git a/tests/bugs/moddata_3/bug33304 b/tests/bugs/moddata_3/bug33304
new file mode 100644 (file)
index 0000000..ba6e514
--- /dev/null
@@ -0,0 +1,9 @@
+puts "==========================================================="
+puts "0033304: Modeling Data - Floating point signal when converting a B-spline curve to analytical form"
+puts "==========================================================="
+
+puts "REQUIRED ALL: Conversion failed"
+
+binrestore [locate_data_file bug33304_bspl_curv.bbrep] a
+mkcurve c a
+tocanon r c