editeng/source/misc/txtrange.cxx |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 9e626a6d2a55a7159e4fd05d72275c7fe8bb0380
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Sat Jul 17 11:05:56 2021 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Sat Jul 17 20:38:55 2021 +0200

    blind fix for ubsan div/0
    
    Change-Id: I0ee929c79d5ac94299adc84ba91d6b0683a8193d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119095
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/editeng/source/misc/txtrange.cxx b/editeng/source/misc/txtrange.cxx
index b8c46e0cdcba..dadc4fc6f315 100644
--- a/editeng/source/misc/txtrange.cxx
+++ b/editeng/source/misc/txtrange.cxx
@@ -194,7 +194,10 @@ tools::Long SvxBoundArgs::CalcMax( const Point& rPt1, 
const Point& rPt2,
         nB = nStart;
     nB *= nB;
     nB += nDa * nDa;
-    nB = nRange + nDa * ( nFarRange - nRange ) / sqrt( nB );
+    nB = sqrt( nB );
+    if (nB == 0) // avoid div / 0
+        return 0;
+    nB = nRange + nDa * ( nFarRange - nRange ) / nB;
 
     bool bNote;
     if( nB < B(rPt2) )
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to