[kig] [Bug 430884] crash during construction of circle by three points

2021-01-10 Thread Maurizio Paolini
https://bugs.kde.org/show_bug.cgi?id=430884

Maurizio Paolini  changed:

   What|Removed |Added

   Version Fixed In||20.12.2
  Latest Commit|https://invent.kde.org/educ |https://invent.kde.org/educ
   |ation/kig/commit/ec283eab82 |ation/kig/commit/fcabe991f6
   |b7c81e9ad3f5d62af375a7ce37d |37150921d15c5aa2ba6d0068a90
   |087 |9b8

--- Comment #4 from Maurizio Paolini  ---
Git commit fcabe991f637150921d15c5aa2ba6d0068a909b8 by Maurizio Paolini.
Committed on 10/01/2021 at 22:50.
Pushed by paolini into branch 'release/20.12'.

Prevent crash during construction of circle by three points

In an "invalid" test the case of exactly superposed points was not
contemplated.
Specifically we also need to cover for the case where norm1 or norm2 is
numerically zero.
FIXED-IN: 20.12.2

M  +1-1misc/common.cpp

https://invent.kde.org/education/kig/commit/fcabe991f637150921d15c5aa2ba6d0068a909b8

-- 
You are receiving this mail because:
You are watching all bug changes.

[kig] [Bug 430884] crash during construction of circle by three points

2021-01-10 Thread Maurizio Paolini
https://bugs.kde.org/show_bug.cgi?id=430884

Maurizio Paolini  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|CONFIRMED   |RESOLVED
  Latest Commit||https://invent.kde.org/educ
   ||ation/kig/commit/ec283eab82
   ||b7c81e9ad3f5d62af375a7ce37d
   ||087

--- Comment #3 from Maurizio Paolini  ---
Git commit ec283eab82b7c81e9ad3f5d62af375a7ce37d087 by Maurizio Paolini.
Committed on 10/01/2021 at 22:43.
Pushed by paolini into branch 'master'.

Prevent crash during construction of circle by three points

In an "invalid" test the case of exactly superposed points was not
contemplated.
Specifically we also need to cover for the case where norm1 or norm2 is
numerically zero.

M  +1-1misc/common.cpp

https://invent.kde.org/education/kig/commit/ec283eab82b7c81e9ad3f5d62af375a7ce37d087

-- 
You are receiving this mail because:
You are watching all bug changes.

[kig] [Bug 430884] crash during construction of circle by three points

2021-01-09 Thread David E. Narvaez
https://bugs.kde.org/show_bug.cgi?id=430884

David E. Narvaez  changed:

   What|Removed |Added

 Ever confirmed|0   |1
 Status|REPORTED|CONFIRMED

--- Comment #2 from David E. Narvaez  ---
Thank you for reporting, looking into, and fixing this bug! I trust your
analysis so please go ahead and:

1) Commit the fix to the master branch but without the comment.
2) Make the contents of the comment part of the commit message instead.
3) Make sure the commit message also has the BUG tag.
4) Cherry-pick the commit to the release/20.12 branch and add the FIXED-IN tag.
This would be fixed in 20.12.2 according to the schedule[0].

[0] https://community.kde.org/Schedules/release_service/20.12_Release_Schedule

-- 
You are receiving this mail because:
You are watching all bug changes.

[kig] [Bug 430884] crash during construction of circle by three points

2021-01-02 Thread Maurizio Paolini
https://bugs.kde.org/show_bug.cgi?id=430884

--- Comment #1 from Maurizio Paolini  ---
There is an easy fix for this problem.  the isSingular function at the
end of misc/common.cpp should test whether a 2x2 matrix is (numerically)
singular.  Currently it does so by testing whether the determinant is small
relative to the product of the norm of the two row vectors, meaning that the
two rows are "nearly parallel" vectors.
However it seems that the two rows where assumed not to be zero (as 2D
vectors).
A quick fix is to change the '<' test into '<=', although here we should also
use some nunmerical threshold value.
Anyway, this at least should fix the NaN problem when drawing a circle through
3 coincident points.  The fix is in a piece of code that I wrote a long long
time ago, so it could be my responsibility to fix it.

diff --git a/misc/common.cpp b/misc/common.cpp
index b13349cd..d841cb62 100644
--- a/misc/common.cpp
+++ b/misc/common.cpp
@@ -489,8 +489,10 @@ bool isSingular( const double& a, const double& b,
 /*
  * test must be done relative to the magnitude of the two
  * row (or column) vectors!
+ *
+ * (2021_01_02: we also need to cover for the case where norm1 or norm2 is
numerically zero!)
  */
-  return ( std::fabs(det) < test_threshold*norm1*norm2 );
+  return ( std::fabs(det) <= test_threshold*norm1*norm2 );
 }

-- 
You are receiving this mail because:
You are watching all bug changes.